/* Homepage specific styles */

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex: 1; /* 确保占据所有剩余空间，将 footer 推到底部 */
    display: flex;
    flex-direction: column;
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
    max-width: 100%;
}

.page-header h1 {
    font-size: 36px;
    color: #1e293b;
    margin-bottom: 12px;
}

.page-header p {
    font-size: 18px;
    color: #64748b;
}

/* Search Bar */
.search-container {
    width: 100%;
    margin: 0 0 30px 0;
}

.search-input {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    width: 100%;
}

.filter-tab {
    padding: 8px 20px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.filter-tab:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.filter-tab.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
    width: 1200px;
    flex: 1; /* 占据父容器剩余空间 */
}

@media (max-width: 968px) {
    .main-layout {
        grid-template-columns: 180px 1fr;
        gap: 20px;
    }

    .sidebar {
        width: 180px;
        min-width: 180px;
        max-width: 180px;
    }
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static !important;
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 28px;
    }

    .page-header p {
        font-size: 16px;
    }
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 20px;
    width: 220px;
    min-width: 220px;
    max-width: 220px;
}

.category-nav {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    width: 100%;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
    text-decoration: none;
    color: inherit;
}

.category-item:hover {
    background: #f1f5f9;
}

.category-item.active {
    background: #e0f2fe;
    color: #0369a1;
}

.category-icon {
    font-size: 24px;
    line-height: 1;
}

.category-name {
    font-size: 15px;
    font-weight: 500;
}

/* Tools Container */
.main-content {
    min-height: 400px;
    width: 100%;
    min-width: 0; /* 允许 flex/grid 子元素正确收缩 */
}

#toolsContainer {
    width: 100%;
    display: block;
}

.tools-section {
    margin-bottom: 50px;
    width: 100%;
    display: block;
}

.tools-section:last-child {
    margin-bottom: 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    width: 100%;
}

.section-icon {
    font-size: 28px;
    line-height: 1;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 20px;
    width: 100%;
}

@media (max-width: 640px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* Tool Card */
.tool-card {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Internal vs External styling */
.tool-card.internal-backend {
    border-left: 4px solid #2563eb;
}

.tool-card.internal-frontend {
    border-left: 4px solid #8b5cf6;
}

.tool-card.external {
    border-left: 4px solid #10b981;
}

.tool-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
}

.tool-icon {
    font-size: 48px;
    flex-shrink: 0;
    line-height: 1;
}

.tool-content {
    flex: 1;
    min-width: 0; /* Allow text to wrap properly */
}

.tool-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1e293b;
}

.tool-description {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
}

/* Badges */
.external-badge,
.featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 20px;
    line-height: 1;
}

.featured-badge {
    top: 12px;
    right: 40px;
}

/* Empty State */
.empty-state,
.loading-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    grid-column: 1 / -1; /* Span all columns */
}

.empty-state p,
.loading-state p,
.error-state p {
    font-size: 16px;
}

.error-state p {
    color: #ef4444;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .page-container {
        padding: 15px;
    }

    .section-title {
        font-size: 20px;
    }

    .filter-tabs {
        margin-bottom: 20px;
    }
}

@media (max-width: 640px) {
    .tool-card {
        padding: 20px;
        gap: 12px;
    }

    .tool-logo,
    .tool-icon {
        width: 40px;
        height: 40px;
        font-size: 40px;
    }

    .tool-title {
        font-size: 16px;
    }

    .tool-description {
        font-size: 13px;
    }
}
