/* ===================================
   Resources Page Styles
   =================================== */

@import './base/variables.css';

/* Resources Hero */
.resources-hero {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--accent-50) 100%);
    padding: 80px 0 60px;
    border-bottom: 1px solid var(--gray-100);
}

.hero-title {
    font-family: 'Crimson Text', serif;
    font-size: 3rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 12px;
    text-align: center;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--gray-600);
    text-align: center;
    max-width: 600px;
    margin: 0 auto 40px;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 60px;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-600);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filter Section */
.filter-section {
    padding: 30px 0;
    background: white;
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.filter-section .container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.filter-label {
    font-size: 0.9rem;
    color: var(--gray-700);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Removed - styles moved to language-filters.css */

.lang-filter {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-filter:hover {
    border-color: var(--primary-400);
    background: var(--primary-50);
    color: var(--primary-700);
}

.filter-section .language-filters .lang-filter.active {
    background-color: var(--filter-active-bg);
    border-color: var(--filter-active-border);
    color: var(--filter-active-color);
}

.filter-section .language-filters .lang-filter.active span {
    color: var(--filter-active-color);
    opacity: 1;
}

.filter-icon {
    font-size: 1.1rem;
}

/* Type Filters */
.type-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.type-filter {
    padding: 10px 16px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.type-filter:hover {
    border-color: var(--primary-400);
    background: var(--primary-50);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.filter-section .type-filters .type-filter.active {
    background-color: var(--filter-active-bg);
    border-color: var(--filter-active-border);
    color: var(--filter-active-color);
    box-shadow: 0 4px 16px rgba(91, 78, 140, 0.25);
}

.filter-section .type-filters .type-filter.active span {
    color: var(--filter-active-color);
    opacity: 1;
}

.type-filter-icon {
    font-size: 1.1rem;
    display: inline-block;
}

.type-filter-label {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Ensure proper contrast on ALL active filter buttons */
.filter-section button.lang-filter.active,
.filter-section button.type-filter.active {
    background-color: var(--filter-active-bg);
    color: var(--filter-active-color);
    border-color: var(--filter-active-border);
}

.filter-section button.lang-filter.active *,
.filter-section button.type-filter.active * {
    color: var(--filter-active-color);
    opacity: 1;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: 8px;
}

.view-btn {
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
}

.view-btn:hover {
    background: white;
    color: var(--gray-900);
}

.view-btn.active {
    background: white;
    color: var(--primary-600);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Resources by Type */
.resources-by-type {
    padding: 60px 0;
    background: #fafafa;
}

.type-section {
    margin-bottom: 60px;
}

.type-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--gray-100);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.type-header:hover {
    padding-left: 8px;
}

.type-icon {
    font-size: 1.5rem;
}

.type-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.type-count {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: auto;
}

/* Collapse Toggle Arrow */
.type-toggle {
    margin-left: 12px;
    font-size: 0.9rem;
    color: var(--gray-400);
    transition: transform 0.3s ease;
}

.type-header.collapsed .type-toggle {
    transform: rotate(-90deg);
}

/* Collapsed state */
.type-header.collapsed {
    margin-bottom: 0;
    padding-bottom: 20px;
}

.type-header.collapsed + .resources-grid {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Resources Grid */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.resources-grid.list-view {
    grid-template-columns: 1fr;
}

/* Resource Card */
.resource-card {
    background: white;
    border: 1px solid var(--gray-100);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.resource-card:hover {
    border-color: var(--gray-200);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Language Badge */
.language-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-700);
    margin-bottom: 8px;
    float: right;
    clear: right;
}

.language-badge.dutch {
    background: #fff4e6;
    border-color: #ffcc80;
    color: #e65100;
}

.language-badge.danish {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}

.language-badge.portuguese {
    background: #fce4ec;
    border-color: #f8bbd0;
    color: #c2185b;
}

.language-badge.italian {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #1565c0;
}

.language-badge.indonesian {
    background: #fff3e0;
    border-color: #ffcc80;
    color: #e65100;
}

.language-badge.korean {
    background: #f3e5f5;
    border-color: #ce93d8;
    color: #7b1fa2;
}

.language-badge.hindi {
    background: #fff8e1;
    border-color: #ffe082;
    color: #f57c00;
}

.language-badge.swahili {
    background: #e0f2f1;
    border-color: #80cbc4;
    color: #00695c;
}

.language-badge.japanese {
    background: #fce4ec;
    border-color: #f8bbd0;
    color: #c2185b;
}

.language-badge.swedish {
    background: #e1f5fe;
    border-color: #81d4fa;
    color: #0277bd;
}

.language-badge.finnish {
    background: #e8eaf6;
    border-color: #9fa8da;
    color: #3949ab;
}

.language-badge.polish {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
}

.language-badge.vietnamese {
    background: #fff9c4;
    border-color: #fff176;
    color: #f57f17;
}

/* Card Content */
.card-header {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.resource-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-600);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
    margin-right: 10px;
    transition: color 0.2s ease;
    clear: left;
    line-height: 1.4;
}

.resource-title:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.resource-description {
    color: var(--gray-600);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 12px;
    flex-grow: 1;
}

.resource-features {
    margin-bottom: 12px;
    color: var(--gray-500);
    font-size: 0.85rem;
}

.feature-item {
    display: inline-block;
    margin-right: 12px;
}

.feature-item::before {
    content: '•';
    margin-right: 4px;
    color: var(--accent-500);
}

/* Resource Meta */
.resource-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
}

.meta-badge {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.meta-badge.free {
    background: var(--accent-100);
    color: var(--accent-700);
}

.meta-badge.paid {
    background: var(--gray-100);
    color: var(--gray-600);
}

.meta-badge.level {
    background: var(--primary-50);
    color: var(--primary-700);
}

/* List View Styles */
.resources-grid.list-view .resource-card {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
}

.resources-grid.list-view .language-badge {
    position: absolute;
    top: 10px;
    right: 15px;
    margin-bottom: 0;
    float: none;
}

.resources-grid.list-view .card-header {
    flex: 1;
    margin-bottom: 0;
}

.resources-grid.list-view .resource-description {
    margin-bottom: 4px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-message {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 0.9rem;
    color: var(--gray-400);
}

/* Loading State */
.loading-card {
    background: white;
    border: 1px solid var(--gray-100);
    border-radius: 8px;
    padding: 20px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading-line {
    height: 12px;
    background: var(--gray-100);
    border-radius: 4px;
    margin-bottom: 8px;
}

.loading-line.title {
    width: 60%;
    height: 16px;
}

.loading-line.description {
    width: 100%;
}

.loading-line.description:last-child {
    width: 80%;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .filter-row {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        gap: 10px;
    }

    .type-filters {
        justify-content: flex-start;
    }

    .view-toggle {
        align-self: center;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .stats-bar {
        gap: 30px;
        padding: 20px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .filter-section .container {
        flex-direction: column;
        gap: 20px;
    }

    /* Removed - handled in language-filters.css */

    .resources-grid {
        grid-template-columns: 1fr;
    }

    .type-header {
        flex-wrap: wrap;
    }

    .type-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .stats-bar {
        flex-wrap: wrap;
        gap: 20px;
    }

    .stat {
        width: 45%;
    }
}

/* Active filter button styling with proper specificity */
.filter-section .lang-filter.active,
.filter-section .type-filter.active,
.filter-section button.lang-filter.active,
.filter-section button.type-filter.active {
    background: var(--filter-active-bg);
    background-color: var(--filter-active-bg);
    color: var(--filter-active-color);
    border: 2px solid #4a3f79;
}

.filter-section .lang-filter.active span,
.filter-section .type-filter.active span,
.filter-section button.lang-filter.active span,
.filter-section button.type-filter.active span,
.filter-section .lang-filter.active *,
.filter-section .type-filter.active *,
.filter-section button.lang-filter.active *,
.filter-section button.type-filter.active * {
    color: var(--filter-active-color);
    opacity: 1;
}

/* Hover state for active buttons */
.filter-section .lang-filter.active:hover,
.filter-section .type-filter.active:hover,
.filter-section button.lang-filter.active:hover,
.filter-section button.type-filter.active:hover {
    background: #6b5e9c;
    background-color: #6b5e9c;
    border-color: var(--filter-active-border);
}