/* === PAGE HEADER === */
.page-header {
    position: relative;
    border-bottom: 2px solid #d4c5a9;
    padding: 120px 30px 50px;
    margin-bottom: 50px;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/vzaimno.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.25;
    z-index: 0;
}

.page-header .page-title,
.page-header .page-subtitle {
    position: relative;
    z-index: 1;
}

.page-header h1 {
    font-size: 2.8rem;
    margin-bottom: 12px;
    text-align: center;
}

.page-subtitle {
    text-align: center;
    font-size: 1.15rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* === SEARCH & FILTER SECTION === */
.search-filter-section {
    margin-bottom: 50px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.search-box {
    width: 100%;
    padding: 16px 20px;
    font-size: 1rem;
    border: 2px solid #d4c5a9;
    background-color: #fefdfb;
    border-radius: 8px;
    font-family: 'Georgia', serif;
    color: #2a2a2a;
    transition: all 0.3s ease;
}

.search-box:focus {
    outline: none;
    border-color: #8b6f47;
    box-shadow: 0 4px 12px rgba(139, 111, 71, 0.15);
}

.filter-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.95rem;
    color: #4a4a4a;
    font-weight: 500;
}

.period-filter {
    padding: 10px 16px;
    font-size: 0.95rem;
    border: 2px solid #d4c5a9;
    background-color: #fefdfb;
    border-radius: 6px;
    font-family: 'Georgia', serif;
    color: #2a2a2a;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 250px;
}

.period-filter:focus {
    outline: none;
    border-color: #8b6f47;
}

.period-filter:hover {
    border-color: #8b6f47;
}

/* === THEMES GRID === */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin: 0 auto 60px auto; /* auto центрира хоризонтално */
    padding: 0 100px; /* равномерен padding вместо margin */
    max-width: 1400px; /* по-голяма стойност */
    box-sizing: border-box;
}

/* === THEME CARD === */
.theme-card {
    background-color: #fefdfb;
    border: 2px solid #e5ddc8;
    border-radius: 12px;
    padding: 32px 28px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

.theme-card:nth-child(1) { animation-delay: 0.1s; }
.theme-card:nth-child(2) { animation-delay: 0.15s; }
.theme-card:nth-child(3) { animation-delay: 0.2s; }
.theme-card:nth-child(4) { animation-delay: 0.25s; }
.theme-card:nth-child(5) { animation-delay: 0.3s; }
.theme-card:nth-child(6) { animation-delay: 0.35s; }
.theme-card:nth-child(7) { animation-delay: 0.4s; }
.theme-card:nth-child(8) { animation-delay: 0.45s; }
.theme-card:nth-child(9) { animation-delay: 0.5s; }
.theme-card:nth-child(10) { animation-delay: 0.55s; }
.theme-card:nth-child(11) { animation-delay: 0.6s; }
.theme-card:nth-child(12) { animation-delay: 0.65s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(139, 111, 71, 0.15);
    border-color: #8b6f47;
}

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

.theme-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    text-align: center;
    opacity: 0.9;
}

.theme-title {
    font-family: 'Palatino', 'Book Antiqua', 'Georgia', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 14px;
    line-height: 1.3;
}

.theme-description {
    font-size: 1rem;
    color: #4a4a4a;
    line-height: 1.7;
    margin-bottom: 20px;
    flex-grow: 1;
}

.theme-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-top: 1px solid #e5ddc8;
    border-bottom: 1px solid #e5ddc8;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.theme-period {
    color: #8b6f47;
    font-weight: 500;
}

.theme-count {
    color: #666;
}

.theme-link {
    color: #8b6f47;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.theme-link:hover {
    color: #6b5537;
    gap: 10px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .page-header {
        padding: 40px 20px 35px;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .page-subtitle {
        font-size: 1rem;
    }

    /* центрирано и запълнено фоново изображение на мобилни */
    .page-header::before {
        background-position: center center;
        background-size: cover;
    }

    .themes-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .period-filter {
        width: 100%;
    }

    .theme-card {
        padding: 24px 20px;
    }

    .theme-meta {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .theme-icon {
        font-size: 2.5rem;
    }

    .theme-title {
        font-size: 1.3rem;
    }
}

.themes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 60px;
}

@media (max-width: 968px) {
    .themes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .themes-grid {
        grid-template-columns: 1fr;
        padding: 0 16px;      /* по-малък страничен падинг за по-широки карти */
        max-width: 100%;      /* картите заемат почти цялата ширина на екрана */
    }
}