/* Library-specific styles */

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 16px;
    border: 2px solid var(--border-color);
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px var(--shadow);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow-lg);
    border-color: var(--accent-primary);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Filter Section */
.filter-section {
    margin-bottom: 40px;
}

.filter-section .section-title {
    margin-bottom: 20px;
    font-size: 1.25rem;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-btn {
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border-color: transparent;
}

/* Search Wrapper */
.search-wrapper {
    position: relative;
    min-width: 250px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 12px 16px 12px 44px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
}

#searchInput:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#searchInput::placeholder {
    color: var(--text-tertiary);
}

/* Back Button */
.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-back:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Library Grid */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

/* Flag Card */
.flag-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 2px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px var(--shadow);
    opacity: 0;
    animation: fadeInCard 0.5s ease forwards;
}

@keyframes fadeInCard {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flag-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--shadow-lg);
    border-color: var(--accent-primary);
}

.flag-card.hidden {
    display: none;
}

.flag-image-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.flag-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.flag-card:hover .flag-image {
    transform: scale(1.1);
}

.flag-info {
    padding: 20px;
}

.flag-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.flag-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flag-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.detail-icon {
    font-size: 1rem;
}

.detail-label {
    font-weight: 600;
    color: var(--text-tertiary);
    min-width: 70px;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* No Results */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.no-results-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.no-results-hint {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-section {
        grid-template-columns: 1fr;
    }

    .filter-buttons {
        justify-content: center;
    }

    .library-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .search-wrapper {
        min-width: 100%;
        order: -1;
    }

    .header-controls {
        flex-direction: column;
        width: 100%;
    }

    .btn-back {
        width: 100%;
    }

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

    .flag-image-wrapper {
        height: 160px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.75rem;
    }

    .filter-btn {
        flex: 1;
        min-width: calc(50% - 6px);
    }

    .flag-name {
        font-size: 1.1rem;
    }
}
