/* ==========================================================================
   1. ШРИФТЫ И БАЗОВЫЕ СТИЛИ
   ========================================================================== */

@font-face {
    font-family: 'Inter Custom';
    src: url('/static/fonts/inter.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden; /* Запрещаем горизонтальный скролл */
    font-family: "Inter Custom", "Geist", "Inter", -apple-system, sans-serif;
    background-color: #f8fafc;
}

/* ==========================================================================
   2. РЕКЛАМНЫЙ БЛОК СВЕРХУ (АДАПТИВНЫЙ)
   ========================================================================== */

.promo-header {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 728px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 3;
}

.promo-slot {
    width: 100%;
    height: 90px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
    padding: 10px;
}

.promo-label {
    align-self: flex-end;
    color: #94a3b8;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

/* ==========================================================================
   3. ЦЕНТРАЛЬНЫЙ БЛОК ДАННЫХ
   ========================================================================== */

.content-overlay {
    position: absolute;
    top: 140px; /* Опускаем ниже рекламного баннера */
    left: 0;
    width: 100%;
    bottom: 40%; /* Оставляем нижние 40% под график */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2;
    pointer-events: none;
    padding: 0 24px;
}

.location {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 16px;
    line-height: 1;
}

/* Контейнер строки дисплея: на десктопе он flex-row */
.main-display-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 64px;
}

/* Блоки статистики */
.extremes-box, .uptime-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.extreme-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ex-label {
    color: rgba(100, 116, 139, 0.65);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ex-val {
    color: #475569;
    font-size: 24px;
    font-weight: 300;
    line-height: 1.2;
    transition: color 0.4s ease;
}

/* Большая центральная цифра */
.voltage-display {
    font-size: 140px; /* Чуть уменьшили базовый размер */
    font-weight: 200;
    letter-spacing: -0.04em;
    line-height: 1;
    margin: 0;
    display: flex;
    align-items: baseline;
    transition: color 0.5s ease;
}

.unit {
    font-size: 40px;
    font-weight: 200;
    color: inherit;
    margin-left: 4px;
}

/* Кнопка Telegram-бота */
.tg-bot-btn {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
    transition: all 0.2s ease;
}

.tg-bot-btn:hover {
    color: #3b82f6;
    border-color: #bfdbfe;
    background-color: #f0fdf4;
}

.error {
    color: #ef4444; font-size: 16px; font-weight: 500; background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* ==========================================================================
   4. НИЖНЯЯ ЗОНА (ГРАФИК И ТЕЛЕМЕТРИЯ)
   ========================================================================== */

.dashboard-core {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35%; /* Отдаем нижнюю часть под график */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 1;
}

.chart-wrapper {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%; z-index: 1;
}

canvas {
    display: block; width: 100%; height: 100%;
}

.telemetry-panel {
    position: relative;
    margin-left: auto;
    width: 240px;
    z-index: 4;
    display: none;
}

.tel-header {
    color: #94a3b8; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px;
}

.tel-row {
    display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 12px;
}

.tel-row:last-child { margin-bottom: 0; }
.tel-label { color: #94a3b8; }
.tel-value { color: #64748b; font-weight: 400; }

/* ==========================================================================
   5. ПОДВАЛ И БАННЕР
   ========================================================================== */

.footer-socials {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 3;
}

.footer-socials a {
    color: #94a3b8; font-size: 11px; text-decoration: none; text-transform: uppercase; transition: color 0.2s;
}
.footer-socials a:hover { color: #3b82f6; }

.cookie-banner {
    position: absolute; bottom: 16px; left: 16px; right: 16px; max-width: 320px;
    background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8); border-radius: 12px; padding: 12px; z-index: 5;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.05); display: none; align-items: center; justify-content: space-between; gap: 12px;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-text { font-size: 11px; color: #475569; line-height: 1.4; }
.cookie-btn { background: #0f172a; color: white; border: none; padding: 6px 12px; border-radius: 6px; font-size: 11px; font-weight: 500; cursor: pointer; }

/* ==========================================================================
   6. ЖЕСТКАЯ МОБИЛЬНАЯ АДАПТАЦИЯ (МЕДИА-ЗАПРОСЫ)
   ========================================================================== */

@media (max-width: 768px) {
    .promo-slot {
        height: 60px;
        font-size: 11px;
    }

    .content-overlay {
        top: 100px;
        bottom: 45%; /* Оставляем больше места внизу под телеметрию и график */
        justify-content: flex-start;
    }

    .main-display-row {
        flex-direction: column;
        gap: 12px;
    }

    .voltage-display {
        font-size: 90px;
        order: 1;
    }

    .unit {
        font-size: 32px;
    }

    .extremes-box {
        order: 2;
        flex-direction: row;
        gap: 32px;
        text-align: center;
        margin-bottom: 4px;
    }

    .uptime-box {
        order: 3;
        align-items: center;
        text-align: center;
    }

    /* АДАПТАЦИЯ НИЖНЕЙ ЗОНЫ И ТЕЛЕМЕТРИИ */
    .dashboard-core {
        height: 40%;
        padding: 0 20px;
        flex-direction: column;
        justify-content: flex-start; /* Выстраиваем элементы сверху вниз */
    }

    .chart-wrapper {
        height: 100%;
        bottom: 0;
    }

    /* Превращаем панель аварии на мобилке в аккуратную легкую плашечку поверх графика */
    .telemetry-panel {
        margin: 16px auto 0 auto;
        width: 100%;
        max-width: 340px;
        background: rgba(255, 255, 255, 0.8); /* Легкая светлая подложка */
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid rgba(226, 232, 240, 0.8);
        border-radius: 12px;
        padding: 14px 16px;
        display: none; /* JS включит при аварии */
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    }

    .tel-header {
        font-size: 10px;
        margin-bottom: 8px;
        text-align: center;
    }

    .tel-row {
        font-size: 11px;
        margin-bottom: 4px;
    }

    /* Футер у самого низа экрана */
    .footer-socials {
        bottom: 12px;
        gap: 16px;
        width: 100%;
        justify-content: center;
    }

    .footer-socials a {
        font-size: 10px;
        font-weight: 500;
    }
}
