/* =============================================================================
   style.css — Модель остывания жидкости
   Стиль: инженерный дашборд, чистый и функциональный
   ============================================================================= */

/* ── Шрифты ────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Переменные ────────────────────────────────────────────────────────────── */
:root {
    --font-main: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --clr-bg: #f5f6f8;
    --clr-surface: #ffffff;
    --clr-border: #dfe2e8;
    --clr-border-focus: #336699;
    --clr-text: #2c3040;
    --clr-text-muted: #6b7280;
    --clr-accent: #336699;
    --clr-accent-light: #e8f0f8;
    --clr-heading: #1a2030;

    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --transition: 150ms ease;
}

/* ── Сброс ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-main);
    color: var(--clr-text);
    background: var(--clr-bg);
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Шапка ─────────────────────────────────────────────────────────────────── */
.header {
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--clr-heading);
    white-space: nowrap;
}

.header .subtitle {
    font-size: 0.8rem;
    color: var(--clr-text-muted);
    font-weight: 300;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Кнопки ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    background: var(--clr-surface);
    color: var(--clr-text);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.btn:hover {
    background: var(--clr-accent-light);
    border-color: var(--clr-accent);
}

.btn.active {
    background: var(--clr-accent);
    color: white;
    border-color: var(--clr-accent);
}

.btn-export {
    background: var(--clr-accent);
    color: white;
    border-color: var(--clr-accent);
}

.btn-export:hover {
    background: #2a5580;
}

.lang-switch {
    display: flex;
    gap: 0;
}

.lang-switch .btn {
    border-radius: 0;
    padding: 5px 10px;
    font-size: 0.8rem;
}

.lang-switch .btn:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.lang-switch .btn:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
    border-left: 0;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.main {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    padding: 20px 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ── Панель параметров ─────────────────────────────────────────────────────── */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.card h2 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--clr-accent);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--clr-accent-light);
}

/* ── Ползунки ──────────────────────────────────────────────────────────────── */
.param-group {
    margin-bottom: 14px;
}

.param-group:last-child {
    margin-bottom: 0;
}

.param-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.param-label span {
    font-size: 0.85rem;
    color: var(--clr-text);
    font-weight: 400;
}

.param-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--clr-accent);
    min-width: 60px;
    text-align: right;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--clr-border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    margin: 4px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--clr-accent);
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--clr-accent);
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* ── Селекты ───────────────────────────────────────────────────────────────── */
select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    background: var(--clr-surface);
    font-family: var(--font-main);
    font-size: 0.85rem;
    color: var(--clr-text);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
}

select:focus {
    border-color: var(--clr-accent);
}

/* ── Чекбокс-тумблер ──────────────────────────────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--clr-border);
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-slider {
    background: var(--clr-accent);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ── Информационная панель ─────────────────────────────────────────────────── */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item .info-label {
    font-size: 0.75rem;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 1px;
}

.info-item .info-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 500;
    color: var(--clr-heading);
}

.info-divider {
    grid-column: 1 / -1;
    height: 1px;
    background: var(--clr-border);
    margin: 4px 0;
}

.info-breakdown {
    grid-column: 1 / -1;
}

.info-breakdown .breakdown-title {
    font-size: 0.75rem;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}

.breakdown-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
    font-size: 0.85rem;
}

.breakdown-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.breakdown-name {
    flex: 1;
    color: var(--clr-text);
}

.breakdown-value {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--clr-heading);
    min-width: 40px;
    text-align: right;
}

/* ── Область графиков ──────────────────────────────────────────────────────── */
.charts-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.chart-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow-sm);
    position: relative;
    height: 340px;
}

/* ── Подвал ────────────────────────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 16px 24px;
    font-size: 0.8rem;
    color: var(--clr-text-muted);
    border-top: 1px solid var(--clr-border);
    margin-top: 20px;
}

/* ── Скрытие ───────────────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .main {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .charts-area {
        grid-template-columns: 1fr;
    }

    .chart-card {
        height: 280px;
    }

    .header {
        padding: 10px 12px;
    }

    .header .subtitle {
        display: none;
    }

    .header h1 {
        font-size: 1.1rem;
    }
}

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

    .lang-switch .btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}

/* ── Print (для PNG экспорта) ──────────────────────────────────────────────── */
@media print {
    .header, .footer, .btn-export {
        display: none;
    }

    .main {
        display: block;
    }

    .charts-area {
        grid-template-columns: 1fr 1fr;
    }
}
