/* =========================
   THEME VARIABLES
========================= */
:root {
    --bg-color: #f6f8fa;
    --text-color: #24292f;
    --header-bg: #ffffff;
    --border-color: #d1d9e0;
    --subtitle-color: #57606a;
    --panel-bg: #f6f6f6;

    --btn-bg: #2f5e6c;
    --btn-hover-bg: #0860ca;
    --menu-active-color: #2f5e6c;

    --accent: #2f5e6c;

    --shadow-sm: 0 4px 14px rgba(0,0,0,0.06);
    --radius: 12px;
}

body.dark-mode {
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --header-bg: #161b22;
    --border-color: #6e7681; /* ← ярче рамки */
    --subtitle-color: #8b949e;
    --panel-bg: #161b22;

    --btn-bg: #0969da;
    --btn-hover-bg: #0860ca;
    --menu-active-color: #c9d1d9;

    --accent: #f5f5f5;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
    padding-top: 48px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================
   LINKS
========================= */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    text-decoration: underline !important;
    text-decoration-color: var(--accent) !important;
    opacity: 1 !important;
}

.btn-primary,
.btn-primary:link,
.btn-primary:visited,
.btn-primary:hover,
.btn-primary:active {
    background-color: var(--btn-bg);
    color: #ffffff;
    text-decoration: none;
}

/* =========================
   TABLES & HR - ИСПРАВЛЕНО
========================= */
table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 20px;
}

table, th, td {
    border: 1px solid var(--border-color);
}

th, td {
    padding: 12px;
    text-align: left;
}

th {
    background-color: rgba(0, 0, 0, 0.03);
    font-weight: 600;
}

/* Горизонтальные разделители - БЕЗ ПРОЗРАЧНОСТИ */
hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}

/* Для тёмной темы */
body.dark-mode table,
body.dark-mode th,
body.dark-mode td {
    border-color: var(--border-color);
}

body.dark-mode th {
    background-color: rgba(255, 255, 255, 0.05);
}

/* =========================
   RELATED ARTICLES - УБРАТЬ ПОДЧЕРКИВАНИЕ
========================= */
.articles-related a,
.article-row-link,
.article-row-link:hover {
    text-decoration: none !important;
}

.article-row-link {
    color: var(--text-color) !important;
    transition: background-color 0.2s ease;
}

.article-row-link:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* =========================
   HEADER
========================= */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
}

.logo {
    font-weight: 700;
    font-size: 18px;
}

.logo .subtitle {
    font-size: 12px;
    color: var(--subtitle-color);
    margin-left: 6px;
}

.right-block {
    display: flex;
    align-items: center;
    gap: 16px;
}

.desktop-menu ul {
    display: flex;
    gap: 20px;
    list-style: none;
}

/* =========================
   MENU LINKS
========================= */

.desktop-menu a,
.mobile-menu a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.desktop-menu a:hover,
.mobile-menu a:hover {
    color: var(--accent);
}

.desktop-menu a:active,
.mobile-menu a:active {
    opacity: 0.7;
}

/* =========================
   MOBILE MENU BUTTON
========================= */
.mobile-menu-button {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-menu-button span {
    display: block;
    height: 2px;
    background: var(--text-color);
    border-radius: 1px;
}

.theme-toggle {
    background: transparent !important;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-color);
    padding: 4px;
}

.theme-toggle:hover {
    color: var(--btn-bg);
}

/* =========================
   MOBILE MENU
========================= */
.mobile-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--panel-bg);
    border-top: 1px solid var(--border-color);
    padding: 10px 20px;
    box-shadow: var(--shadow-sm);
    z-index: 999;
}

.mobile-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-menu.hidden {
    display: none;
}

/* =========================
   HERO / TITLE
========================= */
.home-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-title-right {
    text-align: right;
    margin-bottom: 24px;
    font-size: 42px;
    line-height: 1.2;
}

.home-page p.page-description {
    text-align: center;
    margin-bottom: 40px;
    font-size: 16px;
    color: var(--subtitle-color);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* =========================
   SECTIONS / CARDS
========================= */
.page-block {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--panel-bg);
    padding: 24px;
    margin-bottom: 40px;
}

.site-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}

.section-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    background-color: var(--bg-color);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: background 0.2s, transform 0.2s;
    cursor: pointer;
}

.section-card:hover {
    transform: translateY(-3px);
    background-color: rgba(0,0,0,0.02);
}

.section-card .emoji {
    font-size: 28px;
    flex-shrink: 0;
    margin-right: 10px;
}

.section-card .title {
    font-weight: 600;
    font-size: 18px;
}

/* =========================
   ARTICLES PREVIEW
========================= */
.articles-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.article-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px;
    background-color: var(--bg-color);
    transition: background 0.2s, transform 0.2s;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-card:hover {
    background-color: rgba(0,0,0,0.03);
    transform: translateY(-2px);
}

.article-card .emoji {
    font-size: 22px;
    margin-right: 8px;
}

.article-card .title {
    font-weight: 500;
    font-size: 16px;
}

.articles-preview + .btn-primary {
    margin-top: 16px;
}

/* =========================
   NOTE / CALL TO ACTION
========================= */
.site-note {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    background-color: var(--bg-color);
    margin-bottom: 40px;
}

.btn-primary {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius);
    background-color: var(--btn-bg);
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 16px;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    background-color: var(--btn-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* =========================
   FOOTER
========================= */
footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    text-align: center;
    font-size: 14px;
    color: var(--subtitle-color);
}

footer a {
    color: var(--accent);
    text-decoration: underline;
}

footer a:hover {
    opacity: 0.8;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 768px) {
    .desktop-menu {
        display: none;
    }

    .mobile-menu-button {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
    }

    .mobile-menu-button span {
        display: block;
        height: 2px;
        width: 100%;
        background: var(--text-color);
        border-radius: 1px;
    }

    .right-block {
        gap: 12px;
    }

    .page-title-right {
        font-size: 36px;
        margin-left: 10px;
        margin-right: 10px;
    }

    .home-page {
        padding: 10px;
    }

    .container {
        padding: 0 10px;
    }

    .mobile-menu {
        padding: 10px;
    }

    .page-block,
    .section-card {
        padding: 12px;
    }

    .site-sections {
        gap: 12px;
    }

    .article-card {
        padding: 10px;
    }
}

/* ===== МИНИМАЛИСТИЧНЫЙ ИНДИКАТОР БПЛА ===== */

/* Контейнер для десктопа — чтобы li вел себя как flex */
.bpla-indicator-item {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Сама иконка-ссылка */
.bpla-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none !important;
    background: transparent !important;
    transition: opacity 0.3s ease;
    line-height: 1;
    height: 100%; /* Растягиваем на высоту строки меню */
}

.bpla-indicator .bpla-icon {
    font-size: 20px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

/* Спокойный режим */
.bpla-indicator.alert-safe .bpla-icon {
    opacity: 0.3;
    filter: grayscale(100%) brightness(1.5);
}

/* Тревога */
.bpla-indicator.alert-active .bpla-icon {
    opacity: 1;
    filter: none;
    animation: icon-blink 1.2s ease-in-out infinite;
}

@keyframes icon-blink {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1); 
    }
    50% { 
        opacity: 0.2;
        transform: scale(0.9); 
    }
}

.bpla-indicator:hover {
    opacity: 0.8;
}

/* === ЛОГИКА ПОКАЗА/СКРЫТИЯ === */

/* Десктопная версия индикатора — видна только на десктопе */
.desktop-only {
    display: flex;
}

/* Мобильная версия индикатора — скрыта на десктопе */
.mobile-only {
    display: none;
}

/* === МОБИЛЬНАЯ ВЕРСИЯ === */
@media (max-width: 767px) {
    /* Скрываем десктопный индикатор */
    .desktop-only {
        display: none !important;
    }
    
    /* Показываем мобильный индикатор */
    .mobile-only {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 6px 8px;
        margin: 0 4px;
        height: auto !important; /* ← КЛЮЧЕВОЕ: убираем height: 100% */
        z-index: 999 !important; /* Ниже гамбургера */
    }
    
    .mobile-only .bpla-icon {
        font-size: 22px;
    }
}

/* ===== ФИКС ДЛЯ МОБИЛЬНОГО МЕНЮ ===== */

/* Гамбургер всегда поверх индикатора */
.mobile-menu-button {
    position: relative !important;
    z-index: 1001 !important;
    cursor: pointer;
    pointer-events: auto !important;
}

/* Мобильный индикатор не должен перехватывать клики по гамбургеру */
.bpla-indicator.mobile-only {
    position: relative;
    z-index: 999 !important; /* ← Ниже гамбургера */
    pointer-events: auto;
    flex-shrink: 0;
    margin-right: 8px;
    height: auto !important; /* ← Убираем растягивание */
}

/* right-block тоже должен быть поверх */
.right-block {
    position: relative;
    z-index: 1000;
}