/* Kraeved.ru - Краеведческий портал России */
/* Современный адаптивный дизайн */

:root {
    --primary-color: #2E7D32;
    --primary-dark: #1B5E20;
    --primary-light: #4CAF50;
    --secondary-color: #FF8F00;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #fff;
    --bg-light: #f5f5f5;
    --bg-card: #fff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 8px;
    --max-width: 1200px;
    --transition: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-light);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* Header */
.header {
    background: var(--primary-color);
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo:hover {
    color: #fff;
}

.logo svg {
    width: 36px;
    height: 36px;
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav a {
    color: rgba(255,255,255,0.9);
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
}

/* Search */
.search-box {
    position: relative;
    max-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: none;
    border-radius: 20px;
    font-size: 0.95rem;
    background: rgba(255,255,255,0.95);
    transition: all var(--transition);
}

.search-box input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}

.search-box button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 4px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

.search-results.active {
    display: block;
}

.search-results a {
    display: block;
    padding: 12px 16px;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

.search-results a:last-child {
    border-bottom: none;
}

.search-results a:hover {
    background: var(--bg-light);
}

.search-results .region-type {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Main content */
.main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 30px 20px;
}

/* Hero section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 60px 20px;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Section titles */
.section-title {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--primary-color);
    display: inline-block;
}

/* Regions grid */
.regions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.region-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    border-left: 4px solid var(--primary-color);
}

.region-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.region-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.region-card h3 a {
    color: var(--text-color);
}

.region-card h3 a:hover {
    color: var(--primary-color);
}

.region-card .capital {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.region-card .description {
    font-size: 0.9rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.region-card .tag {
    display: inline-block;
    background: var(--bg-light);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-top: 12px;
}

/* Region types list */
.region-types {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px;
}

.region-type-btn {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-color);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.95rem;
}

.region-type-btn:hover,
.region-type-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}

/* Region page */
.region-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 40px 20px;
}

.region-header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.breadcrumb {
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: rgba(255,255,255,0.8);
}

.breadcrumb a:hover {
    color: #fff;
}

.breadcrumb span {
    margin: 0 8px;
    opacity: 0.6;
}

.region-header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.region-header .capital {
    font-size: 1.1rem;
    opacity: 0.9;
}

.region-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    margin-top: 30px;
}

.region-main {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.region-main h2 {
    font-size: 1.5rem;
    color: var(--primary-dark);
    margin: 30px 0 16px;
}

.region-main h2:first-child {
    margin-top: 0;
}

.region-main p {
    margin-bottom: 16px;
    text-align: justify;
}

.region-main ul {
    margin: 16px 0;
    padding-left: 24px;
}

.region-main li {
    margin-bottom: 8px;
}

/* Attractions list - Accordion */
.attractions-list {
    list-style: none;
    padding: 0;
}

.attractions-list li {
    margin-bottom: 12px;
}

.attraction-item {
    background: var(--bg-light);
    border-radius: var(--radius);
    border-left: 4px solid var(--secondary-color);
    overflow: hidden;
}

.attraction-item summary {
    padding: 16px;
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background var(--transition);
    list-style: none;
}

.attraction-item summary::-webkit-details-marker {
    display: none;
}

.attraction-item summary::after {
    content: '+';
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--secondary-color);
    transition: transform var(--transition);
}

.attraction-item[open] summary::after {
    content: '−';
}

.attraction-item summary:hover {
    background: rgba(0,0,0,0.03);
}

.attraction-desc {
    padding: 0 16px 16px;
    color: var(--text-light);
    line-height: 1.7;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebar */
.region-sidebar {
    position: sticky;
    top: 80px;
    height: fit-content;
}

.sidebar-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.sidebar-card h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.sidebar-card ul {
    list-style: none;
    padding: 0;
}

.sidebar-card li {
    margin-bottom: 8px;
}

.sidebar-card a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: var(--radius);
    transition: background var(--transition);
}

.sidebar-card a:hover {
    background: var(--bg-light);
}

/* Flowers promo block */
.flowers-promo {
    background: linear-gradient(135deg, #E91E63 0%, #AD1457 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.flowers-promo h3 {
    border: none;
    margin-bottom: 12px;
}

.flowers-promo p {
    font-size: 0.95rem;
    margin-bottom: 16px;
    opacity: 0.95;
}

.flowers-promo .btn {
    display: inline-block;
    background: #fff;
    color: #E91E63;
    padding: 10px 24px;
    border-radius: 25px;
    font-weight: 600;
    transition: all var(--transition);
}

.flowers-promo .btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Flowers article */
.flowers-article {
    background: linear-gradient(to right, #fff5f8, #fff);
    border: 2px solid #E91E63;
    border-radius: var(--radius);
    padding: 24px;
    margin: 30px 0;
}

.flowers-article h2 {
    color: #E91E63 !important;
}

.flowers-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #E91E63;
    color: #fff;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    margin-top: 16px;
    transition: all var(--transition);
}

.flowers-link:hover {
    background: #AD1457;
    color: #fff;
    transform: translateX(4px);
}

/* Source */
.source {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Footer */
.footer {
    background: var(--primary-dark);
    color: #fff;
    padding: 40px 20px;
    margin-top: 60px;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.footer h4 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.footer a {
    color: rgba(255,255,255,0.8);
}

.footer a:hover {
    color: #fff;
}

.footer ul {
    list-style: none;
}

.footer li {
    margin-bottom: 8px;
}

.footer-bottom {
    max-width: var(--max-width);
    margin: 30px auto 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Catalog page */
.catalog-header {
    text-align: center;
    padding: 40px 0;
}

.catalog-header h1 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.catalog-header p {
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

.catalog-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 30px 0;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
}

.region-group {
    margin-bottom: 40px;
}

.region-group h2 {
    font-size: 1.4rem;
    color: var(--primary-dark);
    margin-bottom: 20px;
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
}

/* Search page */
.search-page {
    text-align: center;
    padding: 40px 0;
}

.search-page h1 {
    margin-bottom: 24px;
}

.search-page .search-box {
    max-width: 500px;
    margin: 0 auto 40px;
}

.search-page .search-box input {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    padding: 16px 50px 16px 20px;
    font-size: 1.1rem;
    border-radius: 30px;
}

.search-page .search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46,125,50,0.1);
}

.search-page-results {
    text-align: left;
}

/* Responsive */
@media (max-width: 1024px) {
    .region-content {
        grid-template-columns: 1fr;
    }

    .region-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        margin-top: 12px;
    }

    .nav.active {
        display: flex;
    }

    .nav a {
        width: 100%;
        padding: 12px;
        border-radius: 0;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .nav-toggle {
        display: block;
    }

    .search-box {
        width: 100%;
        max-width: none;
        margin-top: 12px;
        order: 3;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.4rem;
    }

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

    .region-header h1 {
        font-size: 1.6rem;
    }

    .region-main {
        padding: 20px;
    }

    .catalog-stats {
        flex-wrap: wrap;
        gap: 20px;
    }

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

    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .main {
        padding: 20px 12px;
    }

    .hero {
        padding: 40px 16px;
    }

    .region-type-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* --- Карточки регионов в каталоге (генерируются generate.py) --- */
.region-card {
    display: block;
    color: inherit;
    text-decoration: none;
}

.region-card:hover h3 {
    color: var(--primary-color);
}

.region-card-capital {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.region-card-teaser {
    font-size: 0.9rem;
    color: var(--text-light);
}

.card-flowers {
    display: inline-block;
    margin-top: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #FFF3E0;
    color: #E65100;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Заголовок партнёрского блока внутри статьи */
.flowers-article h3 {
    color: var(--primary-dark);
    margin-bottom: 10px;
    font-size: 1.15rem;
}

/* Хлебные крошки в каталоге */
.catalog-header .breadcrumb {
    margin-bottom: 12px;
}

/* Крошки на светлом фоне каталога и страниц округов */
.catalog-header .breadcrumb a {
    color: var(--primary-color);
}

.catalog-header .breadcrumb a:hover {
    color: var(--primary-dark);
}

.district-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
}

.district-list li a {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.9rem;
}

.district-list li a:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.sidebar-note {
    font-size: 0.85rem;
    margin: -4px 0 10px;
}

/* Контраст ссылок на цветных подложках */
.region-header a,
.region-header .breadcrumb a {
    color: rgba(255,255,255,0.9);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.region-header a:hover {
    color: #fff;
}

.flowers-promo a:not(.btn) {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.flowers-promo a:not(.btn):hover {
    color: #FFF3E0;
}

/* Ссылка внутри строки-справки не должна становиться блоком */
.sidebar-card li strong + a {
    display: inline;
    padding: 0;
}

/* На узких экранах выключка по ширине рвёт строки пробелами */
@media (max-width: 600px) {
    .region-main p,
    .attraction-desc {
        text-align: left;
    }
}

/* Пустой результат поиска (раньше стиль был инлайном в JS) */
.search-no-results {
    padding: 16px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Print styles */
@media print {
    .header, .footer, .region-sidebar, .search-box, .nav {
        display: none !important;
    }

    .region-content {
        grid-template-columns: 1fr;
    }

    .region-main {
        box-shadow: none;
        padding: 0;
    }
}
