/* ============================================================
   ROOT ПЕРЕМЕННЫЕ
   ============================================================ */
:root {
    --bg: #fff;
    --text: #000;
    --link: #003a8c;
    --link-hover: #0055b3;
    --border: #bbb;
    --card-bg: #f9f9f9;
    --hover: #e8e8e8;
    --focus: #ffbf47;
    --bkl-color: #0054a6;
    --mcd-color: #e31e24;
    --radius: 8px;
    --transition: 0.2s ease;
}

/* ============================================================
   БАЗОВЫЕ СТИЛИ
   ============================================================ */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 16px;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, system-ui, -apple-system, sans-serif;
    font-size: 20px;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

/* ============================================================
   ЗАГОЛОВКИ
   ============================================================ */
h1 {
    font-size: 1.8rem;
    margin: 0 0 4px 0;
}

h2 {
    font-size: 1.4rem;
    margin: 24px 0 12px 0;
}

/* ============================================================
   ССЫЛКИ
   ============================================================ */
a {
    color: var(--link);
    font-weight: 600;
    padding: 4px 6px;
    text-decoration: none;
    border-radius: 4px;
}
a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}
a:focus {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

/* ============================================================
   ХЛЕБНЫЕ КРОШКИ
   ============================================================ */
.breadcrumbs {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 16px;
    padding: 8px 0;
}
.breadcrumbs a {
    font-weight: 500;
}

/* ============================================================
   БЕЙДЖИ (метки БКЛ / МЦД)
   ============================================================ */
.badge {
    display: inline-block;
    padding: 0 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    margin-left: 8px;
    vertical-align: middle;
    line-height: 1.8;
}
.badge-bkl {
    background: var(--bkl-color);
}
.badge-mcd {
    background: var(--mcd-color);
}

.station-badge {
    display: inline-block;
    padding: 2px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: var(--bkl-color);
    margin-bottom: 12px;
}

/* ============================================================
   НАВИГАЦИЯ МЕЖДУ СТАНЦИЯМИ
   ============================================================ */
.nav-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    margin: 16px 0;
    padding: 12px 0;
    border-top: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
}
.nav-links .current {
    color: #999;
    font-weight: 400;
    flex: 1;
    text-align: center;
}

/* ============================================================
   ПОИСК
   ============================================================ */
.search-section {
    margin: 16px 0;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
}

.search-label {
    font-weight: 700;
    display: block;
    margin-bottom: 8px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1.1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
}
.search-input:focus {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.search-hint {
    font-size: 0.85rem;
    color: #666;
    margin-top: 6px;
}
.search-hint kbd {
    background: #eee;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #ccc;
}

/* ============================================================
   РЕЗУЛЬТАТЫ ПОИСКА
   ============================================================ */
.search-results {
    margin-top: 12px;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--border);
}

.search-results ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-results li {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}
.search-results li:last-child {
    border-bottom: none;
}
.search-results li:hover {
    background: var(--hover);
}
.search-results li a {
    display: block;
    font-weight: 600;
    padding: 4px 0;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #666;
}

/* ============================================================
   ГРУППЫ СТАНЦИЙ (аккордеоны на главной)
   ============================================================ */
.section-group {
    display: block;
    margin: 24px 0;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
}

.section-group-summary {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 14px 20px;
    cursor: pointer;
    background: #e8e8e8;
    list-style: none;
    border-radius: 6px;
    user-select: none;
}
.section-group-summary:hover {
    background: #ddd;
}
.section-group-summary::-webkit-details-marker {
    display: none;
}

.section-group-content {
    padding: 12px 16px 16px;
}
.section-group[open] .section-group-content {
    animation: fade 0.25s ease;
}

/* ============================================================
   СЕТКА СТАНЦИЙ (на главной)
   ============================================================ */
.station-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 20px;
}
.station-grid a {
    padding: 6px 8px;
    display: block;
    border-radius: 4px;
}
.station-grid a:hover {
    background: var(--hover);
    text-decoration: none;
}

/* ============================================================
   АККОРДЕОН СТАНЦИИ (на странице станции)
   ============================================================ */
.station-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    margin-bottom: 8px;
}

.station-item summary {
    font-size: 1.15rem;
    font-weight: 600;
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    border-radius: 5px;
}
.station-item summary:hover {
    background: var(--hover);
}
.station-item summary::-webkit-details-marker {
    display: none;
}

.station-content {
    padding: 0 14px 14px;
    border-top: 1px solid var(--border);
}
.station-item[open] .station-content {
    animation: fade 0.2s ease;
}

/* Вложенные аккордеоны внутри станции */
.station-content details {
    margin: 6px 0;
}
.station-content details summary {
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    list-style: none;
}
.station-content details summary::-webkit-details-marker {
    display: none;
}
.station-content details[open] summary {
    color: var(--link);
}

.station-content ul,
.station-content ol {
    margin: 4px 0 4px 18px;
}
.station-content p {
    margin: 4px 0;
}
.station-content li {
    margin-bottom: 2px;
}

/* ============================================================
   СТАТИСТИКА
   ============================================================ */
.stats {
    font-size: 0.9rem;
    color: #555;
    margin-top: 8px;
}

/* ============================================================
   КНОПКА "НАЗАД"
   ============================================================ */
.back-to-menu {
    display: inline-block;
    margin-top: 16px;
    font-size: 0.95rem;
}

/* ============================================================
   ФУТЕР
   ============================================================ */
.footer {
    margin-top: 30px;
    padding-top: 16px;
    font-size: 0.9rem;
    color: #555;
    border-top: 2px solid var(--border);
}

/* ============================================================
   АНИМАЦИИ
   ============================================================ */
@keyframes fade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 600px) {
    body {
        padding: 10px;
        font-size: 18px;
    }
    .container {
        padding: 12px;
    }
    .station-grid {
        grid-template-columns: 1fr;
    }
    .section-group-summary {
        font-size: 1.2rem;
        padding: 12px 16px;
    }
    .station-item summary {
        font-size: 1rem;
        padding: 8px 12px;
    }
    .nav-links {
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }
    .nav-links .current {
        order: -1;
    }
    .search-results {
        max-height: 300px;
    }
}

/* ============================================================
   ПЕЧАТЬ (для удобства)
   ============================================================ */
@media print {
    body {
        font-size: 14px;
        padding: 0;
        background: #fff;
    }
    .container {
        border: none;
        padding: 10px;
    }
    .nav-links,
    .search-section,
    .breadcrumbs a,
    .back-to-menu {
        display: none;
    }
    .station-item {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
    .station-item summary {
        background: #f0f0f0 !important;
    }
}
