/* ============================================================
   СОННИК — ОСНОВНЫЕ СТИЛИ
   Тёмная ночная тема с glassmorphism и анимацией звёзд
   ============================================================ */

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-card: rgba(255,255,255,0.05);
    --bg-card-hover: rgba(255,255,255,0.09);
    --glass: rgba(255,255,255,0.07);
    --glass-border: rgba(255,255,255,0.1);
    --text-primary: #e8e8f0;
    --text-secondary: #9898b8;
    --text-muted: #666688;
    --accent: #6c63ff;
    --accent-light: #8b84ff;
    --accent-glow: rgba(108, 99, 255, 0.3);
    --gold: #ffd700;
    --gold-light: #ffe44d;
    --danger: #ff4757;
    --success: #2ed573;
    --border: rgba(255,255,255,0.08);
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-card: 0 4px 20px rgba(0,0,0,0.3);
    --radius: 16px;
    --radius-sm: 8px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Inter', sans-serif;
    --font-display: 'Playfair Display', serif;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   ЗВЁЗДНЫЙ ФОН
   ============================================================ */
.stars {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: twinkle var(--dur, 4s) ease-in-out infinite;
    opacity: 0;
}

@keyframes twinkle {
    0%, 100% { opacity: 0; transform: scale(0.8); }
    50% { opacity: var(--op, 0.8); transform: scale(1.2); }
}

/* Nebula background */
body::before {
    content: '';
    position: fixed;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(ellipse at 20% 20%, rgba(108,99,255,0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 80%, rgba(255,99,180,0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 50%, rgba(99,200,255,0.04) 0%, transparent 60%);
    z-index: 0;
    pointer-events: none;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.main-content {
    padding: 30px 0 60px;
    position: relative;
    z-index: 1;
}

.page-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 30px;
    align-items: start;
}

.page-layout-full {
    max-width: 900px;
    margin: 0 auto;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 350;
    background: rgba(10,10,26,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 70px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.logo-text {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo-dot { color: var(--accent); }

/* Footer logo — override .footer-col a color inheritance */
.footer-brand .logo { color: var(--text-primary); }
.footer-brand .logo-icon {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #a855f7);
}
.footer-brand .logo-icon i { color: #fff !important; opacity: 1 !important; }
.footer-brand .logo-text { color: var(--text-primary); }
.footer-brand .logo-dot { color: var(--accent); }

/* Navigation */
.main-nav { flex: 1; }
.main-nav ul { list-style: none; display: flex; gap: 4px; }
.main-nav a {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}
.main-nav a:hover, .main-nav a.active {
    color: var(--text-primary);
    background: var(--glass);
}
.main-nav a.active { color: var(--accent-light); }

/* Header Search */
.header-search {
    display: flex;
    align-items: center;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    overflow: hidden;
    flex-shrink: 0;
}

.header-search input {
    background: none; border: none; outline: none;
    padding: 8px 16px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 14px;
    width: 180px;
}

.header-search input::placeholder { color: var(--text-muted); }

.header-search button {
    background: none; border: none; cursor: pointer;
    padding: 8px 14px;
    color: var(--text-secondary);
    transition: var(--transition);
}
.header-search button:hover { color: var(--accent); }

    /* === Overlay для поиска — перекрывает меню === */
    body.search-open .main-nav.open {
        display: none !important;
    }
    body.search-open #nav-overlay.active {
        display: none !important;
    }
    .search-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 390;
        backdrop-filter: blur(2px);
    }
    body.search-open .search-overlay {
        display: block;
    }


/* Burger */
.burger {
    display: none;
    flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer;
    padding: 8px;
}
.burger span {
    display: block; width: 24px; height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   AD BLOCKS
   ============================================================ */
.ad-block {
    position: relative;
    z-index: 1;
    text-align: center;
    overflow: hidden;
}

.ad-top {
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    min-height: 90px;
}

.ad-sidebar {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 250px;
    margin-bottom: 24px;
}

.ad-before-footer {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
    padding: 16px 0;
    min-height: 90px;
    margin-top: 40px;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
    text-align: center;
    padding: 60px 20px;
    position: relative;
}

.hero-icon {
    font-size: 64px;
    animation: floatMoon 4s ease-in-out infinite;
    display: inline-block;
    margin-bottom: 24px;
    filter: drop-shadow(0 0 30px rgba(108,99,255,0.6));
}

@keyframes floatMoon {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-12px) rotate(5deg); }
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff 0%, var(--accent-light) 50%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.hero p {
    font-size: clamp(15px, 2vw, 18px);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 32px;
}

/* Hero Search */
.hero-search {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    gap: 0;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(108,99,255,0.2);
}

.hero-search input {
    flex: 1; border: none; outline: none;
    background: none;
    padding: 16px 24px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: var(--font-main);
}

.hero-search input::placeholder { color: var(--text-muted); }

.hero-search button {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border: none; cursor: pointer;
    padding: 16px 28px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    display: flex; align-items: center; gap: 8px;
    transition: var(--transition);
}

.hero-search button:hover { opacity: 0.9; transform: scale(0.98); }

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.hero-stat {
    display: flex; flex-direction: column;
    align-items: center; gap: 4px;
}

.hero-stat-num {
    font-size: 28px; font-weight: 700;
    color: var(--accent-light);
}

.hero-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-title {
    display: flex; align-items: center; gap: 12px;
    font-family: var(--font-display);
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 700;
    margin-bottom: 28px;
    color: var(--text-primary);
}

.section-title i {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* ============================================================
   DREAMBOOK CARDS (Главная)
   ============================================================ */
.dreambooks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.dreambook-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: block;
}

.dreambook-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--card-color, var(--accent));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.dreambook-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--card-color, var(--accent));
}

.card-header {
    display: flex; align-items: flex-start;
    gap: 16px; margin-bottom: 16px;
}

.card-icon {
    width: 56px; height: 56px;
    background: var(--card-color, var(--accent));
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    opacity: 0.85;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.card-title-wrap h2 {
    font-family: var(--font-display);
    font-size: 18px; font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.card-title-wrap .card-author {
    font-size: 12px;
    color: var(--text-muted);
}

.card-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex; align-items: center;
    justify-content: space-between;
}

.card-count {
    font-size: 12px;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 5px;
}

.card-link {
    font-size: 13px; font-weight: 600;
    color: var(--card-color, var(--accent));
    display: flex; align-items: center; gap: 5px;
    transition: var(--transition);
}

.dreambook-card:hover .card-link { gap: 9px; }

/* ============================================================
   ALPHABET NAV
   ============================================================ */
.alpha-nav {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 28px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.alpha-nav a, .alpha-nav span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.alpha-nav a {
    color: var(--text-secondary);
    background: transparent;
}

.alpha-nav a:hover {
    background: var(--glass);
    color: var(--text-primary);
}

.alpha-nav a.active {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.alpha-nav span {
    color: var(--text-muted);
    cursor: default;
}

/* ============================================================
   DREAMS LIST
   ============================================================ */
.dreams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.dream-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    display: flex; align-items: center; gap: 8px;
}

.dream-item i { color: var(--accent); font-size: 12px; flex-shrink: 0; }

.dream-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent-light);
    transform: translateX(4px);
}

.dream-item .dream-count {
    margin-left: auto;
    background: var(--glass);
    border-radius: 20px;
    padding: 2px 7px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================================
   DREAM DETAIL PAGE
   ============================================================ */
.dream-page-header {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    margin-bottom: 32px;
    text-align: center;
}

.dream-page-icon {
    font-size: 48px;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 20px rgba(108,99,255,0.5));
}

.dream-page-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #fff, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Quick nav */
.quick-nav {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.quick-nav-title {
    font-size: 12px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-muted); margin-bottom: 10px;
}

.quick-nav-list {
    display: flex; flex-wrap: wrap; gap: 6px;
}

.quick-nav-list a {
    padding: 5px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.quick-nav-list a:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Interpretation blocks */
.interpretations-list { display: flex; flex-direction: column; gap: 24px; }

.interpretation-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.interpretation-block:hover {
    border-color: var(--block-color, var(--accent));
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.interp-header {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}

.interp-color-bar {
    width: 4px; height: 100%;
    position: absolute;
    left: 0; top: 0;
    background: var(--block-color);
    border-radius: 2px;
}

.interp-icon {
    width: 44px; height: 44px;
    background: var(--block-color, var(--accent));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
    opacity: 0.85;
}

.interp-title h2 {
    font-family: var(--font-display);
    font-size: 17px; font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.interp-title .interp-author {
    font-size: 12px; color: var(--text-muted);
}

.interp-anchor {
    margin-left: auto;
    font-size: 11px; color: var(--text-muted);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.interp-anchor:hover { color: var(--accent); border-color: var(--accent); }

.interp-body {
    padding: 24px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* ============================================================
   DREAMBOOK PAGE
   ============================================================ */
.dreambook-header {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 32px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;
    align-items: center;
}

.dreambook-header-icon {
    width: 80px; height: 80px;
    background: var(--card-color, var(--accent));
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.dreambook-header h1 {
    font-family: var(--font-display);
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.dreambook-meta { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.dreambook-meta span {
    display: flex; align-items: center; gap: 6px;
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px; color: var(--text-muted);
}

.dreambook-desc {
    color: var(--text-secondary);
    font-size: 14px; line-height: 1.7;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.widget-title {
    font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}

.widget-title i { color: var(--accent); }

.widget-list { list-style: none; }
.widget-list li {
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
}
.widget-list li:last-child { border-bottom: none; }
.widget-list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
    display: flex; align-items: center; gap: 6px;
}
.widget-list a:hover { color: var(--accent-light); padding-left: 4px; }

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumbs {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin-bottom: 24px;
    font-size: 13px; color: var(--text-muted);
}

.breadcrumbs a {
    color: var(--text-muted); text-decoration: none;
    transition: var(--transition);
}
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--border); }
.breadcrumbs .current { color: var(--text-secondary); }

/* ============================================================
   SEARCH RESULTS
   ============================================================ */
.search-results-header {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex; align-items: center; gap: 12px;
}

.search-results-header h1 {
    font-size: 20px; font-weight: 700;
}

.search-query {
    color: var(--accent-light); font-style: italic;
}

.search-count {
    margin-left: auto;
    font-size: 13px; color: var(--text-muted);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex; justify-content: center;
    align-items: center; gap: 6px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.pagination a {
    background: var(--bg-card);
    color: var(--text-secondary);
}

.pagination a:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.pagination .current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.pagination .dots {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
    cursor: default;
}

/* ============================================================
   LETTER SECTION
   ============================================================ */
.letter-section { margin-bottom: 32px; }
.letter-heading {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 700;
    color: var(--accent-light);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}

/* ============================================================
   CARDS — ALL DREAMBOOKS PAGE
   ============================================================ */
.books-table {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.books-table-row {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.books-table-row:last-child { border-bottom: none; }
.books-table-row:hover { background: var(--bg-card-hover); }

.books-table-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

.books-table-info h3 {
    font-size: 15px; font-weight: 600;
    color: var(--text-primary); margin-bottom: 3px;
}

.books-table-info p {
    font-size: 12px; color: var(--text-muted);
}

.books-table-count {
    font-size: 12px; color: var(--text-muted);
    text-align: right; white-space: nowrap;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; display: block; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-secondary); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 50px 0 24px;
    position: relative;
    z-index: 1;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand p {
    color: var(--text-muted); font-size: 13px;
    margin-top: 12px; line-height: 1.6;
}

.footer-stats {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-top: 16px;
}

.footer-stats span {
    display: flex; align-items: center; gap: 5px;
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px; color: var(--text-muted);
}

.footer-col h4 {
    font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 6px;
}

.footer-col h4 i { color: var(--accent); font-size: 11px; }

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a {
    color: var(--text-muted); text-decoration: none;
    font-size: 13px;
    display: flex; align-items: center; gap: 6px;
    transition: var(--transition);
}
.footer-col a i { font-size: 10px; color: var(--accent); opacity: 0.5; }
.footer-col a:hover { color: var(--text-primary); padding-left: 4px; }

.footer-disclaimer {
    margin-top: 16px;
    font-size: 11px; color: var(--text-muted);
    background: rgba(255,71,87,0.1);
    border: 1px solid rgba(255,71,87,0.2);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    display: flex; gap: 6px; align-items: flex-start;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}
.footer-sub { margin-top: 6px; opacity: 0.7; }

/* ============================================================
   UTILITIES
   ============================================================ */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}

.badge-accent { background: var(--accent-glow); color: var(--accent-light); }
.badge-gold { background: rgba(255,215,0,0.15); color: var(--gold); }

.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ── Мобильное меню: оверлей ─────────────────────────── */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 250;
    backdrop-filter: blur(2px);
}
.nav-overlay.active { display: block; }
body.nav-open { overflow: hidden; }

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

@media (max-width: 900px) {
    .page-layout {
        grid-template-columns: 1fr;
    }
    .page-layout .sidebar { order: -1; }

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

    .dreambook-header { grid-template-columns: 1fr; text-align: center; }
    .dreambook-header-icon { margin: 0 auto; }
}

@media (max-width: 768px) {
    .main-nav { display: none; }
    .main-nav.open { display: block; position: absolute; top: 100%; left: 0; right: 0; min-height: calc(100vh - 70px); background: var(--bg-primary); z-index: 300; padding: 20px; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.6); border-top: 1px solid var(--border); }
    .main-nav.open ul { flex-direction: column; gap: 4px; }
    .main-nav.open a { font-size: 16px; padding: 14px; color: var(--text-primary) !important; display: flex; border-radius: var(--radius-sm); }
    .main-nav.open a:hover, .main-nav.open a.active { background: var(--glass); color: var(--accent-light) !important; }
    .main-nav.open ul li { border-bottom: 1px solid var(--border); }

    /* Поиск в шапке на мобильных: показываем иконку, раскрывается при клике */
    .header-search {
        display: flex; padding: 0;
        background: none; border: none; gap: 0;
        position: relative;
    }
    .header-search input {
        display: none;
        width: 0;
        opacity: 0;
        transition: width 0.3s ease, opacity 0.3s ease;
    }
    .header-search.expanded {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        width: 100%;
        max-width: 100%;
        z-index: 1001;
        background: var(--bg-header, var(--bg-secondary));
        border: none;
        border-bottom: 1px solid var(--border);
        border-radius: 0;
        overflow: visible;
        display: flex;
        align-items: center;
        padding: 0 16px;
        height: 60px;
        box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    }
    .header-search.expanded input {
        display: block;
        flex: 1;
        width: 100%;
        opacity: 1;
        padding: 8px 12px;
        background: none;
        border: none;
        outline: none;
        color: var(--text-primary);
        font-size: 16px;
    }
    .header-search button {
        background: var(--glass);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        width: 38px; height: 38px;
        color: var(--text-secondary);
        font-size: 15px;
        display: flex; align-items: center; justify-content: center;
        flex-shrink: 0;
        transition: var(--transition);
    }
    .header-search.expanded button {
        background: none;
        border: none;
        color: var(--accent);
    }
    .header-search button:hover { color: var(--accent); }

    /* === Overlay для поиска — перекрывает меню === */
    body.search-open .main-nav.open {
        display: none !important;
    }
    body.search-open #nav-overlay.active {
        display: none !important;
    }
    .search-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 390;
        backdrop-filter: blur(2px);
    }
    body.search-open .search-overlay {
        display: block;
    }

    /* Overlay при открытом поиске — используем .search-overlay вместо ::before */
    body.search-open::before { content: none; display: none; }

    /* Поднимаем сайт-хедер над оверлеем при открытом поиске */
    body.search-open .site-header { z-index: 1200; }
    .burger { display: flex; }

    .hero { padding: 40px 0; }
    .hero-stats { gap: 24px; }

    .dreams-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }

    .sidebar .sidebar-widget,
    .sidebar .ad-sidebar,
    .sidebar-widget,
    .ad-sidebar,
    #yandex_rtb_R-A-XXXXXXX-2 {
        display: none !important;
    }

    .footer-grid { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 480px) {
    /* Скрыть текст "Найти" в поисковых кнопках, оставить только иконку */
    .header-search button .btn-text,
    .hero-search button .btn-text { display: none; }
    .hero-search button { padding: 0 16px; min-width: 44px; }

    .alpha-nav { gap: 4px; }
    .alpha-nav a, .alpha-nav span { width: 30px; height: 30px; font-size: 12px; }
    .books-table-row { grid-template-columns: 40px 1fr; }
    .books-table-count { display: none; }
}
