/* ============================================================
   Калькуляторы ЖКХ — стили
   Все блоки одной ширины — 1600px (как .nav-inner)
   ============================================================ */

/* CSS-переменные для страниц калькуляторов (синхронизированы с landing.css и приложением) */
:root {
    --brand-dark:    #0d3b3a;
    --brand-dark-2:  #15524f;
    --brand-peach:   #f0a080;
    --brand-peach-2: #e88b68;
    --brand-cream:   #faf8f5;
    --brand-mint:    #7fb8a8;

    --primary: var(--brand-dark);
    --accent: var(--brand-peach);
    --accent-hover: var(--brand-peach-2);

    --bg: #0a1f1e;
    --bg-soft: #0f2a28;
    --bg-card: #13312f;
    --bg-elevated: #173a37;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);

    --radius: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;

    --gradient: linear-gradient(135deg, #0d3b3a 0%, #1a5a56 40%, #f0a080 100%);
}

html[data-theme="light"] {
    --primary: var(--brand-dark);
    --accent: var(--brand-peach);
    --accent-hover: var(--brand-peach-2);

    --bg: var(--brand-cream);
    --bg-soft: #f2ede6;
    --bg-card: #ffffff;
    --bg-elevated: #faf8f5;
    --border: rgba(13, 59, 58, 0.10);
    --border-strong: rgba(13, 59, 58, 0.18);
    --text: #0d3b3a;
    --text-muted: #4a6b69;
    --text-dim: #6b8683;

    --shadow-sm: 0 2px 8px rgba(13, 59, 58, 0.06);
    --shadow-md: 0 8px 30px rgba(13, 59, 58, 0.10);
    --shadow-lg: 0 20px 60px rgba(13, 59, 58, 0.15);
}

html[data-theme="dark"] {
    --primary: var(--brand-mint);
    --accent: var(--brand-peach);
    --accent-hover: var(--brand-peach-2);

    --bg: #0a1f1e;
    --bg-soft: #0f2a28;
    --bg-card: #13312f;
    --bg-elevated: #173a37;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body.calc-page {
    overflow-x: hidden;
    max-width: 100vw;
}

.calc-page { background: var(--bg); }

.calc-main {
    padding: 32px 0 60px;
    min-height: 60vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Контейнер — ширина как у шапки */
.calc-container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
}

/* Хлебные крошки */
.calc-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.calc-breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color .15s;
}
.calc-breadcrumbs a:hover { color: var(--accent); }
.calc-breadcrumbs-sep { opacity: 0.4; }
.calc-breadcrumbs-current { color: var(--text); }

/* Заголовок */
.calc-header {
    margin-bottom: 32px;
    text-align: center;
}
.calc-header h1 {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    line-height: 1.15;
}
.calc-header h1 svg { color: var(--accent); flex-shrink: 0; }
.calc-subtitle {
    color: var(--text-muted);
    font-size: 16px;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Форма */
.calc-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.calc-form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.calc-mode {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: border-color .15s, background .15s;
}
.calc-mode:hover { border-color: var(--accent); }
.calc-mode input[type="radio"] {
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
}
.calc-mode:has(input:checked) {
    border-color: var(--accent);
    background: rgba(240, 160, 128, 0.08);
}

.calc-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: start;
}

/* Поля с длинными подписями — на всю ширину */
.calc-field-full {
    grid-column: 1 / -1;
}

.calc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.calc-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.calc-field input,
.calc-field select {
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    box-sizing: border-box;
    font-variant-numeric: tabular-nums;
}
.calc-field input:focus,
.calc-field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(240, 160, 128, 0.2);
}

/* Результат */
.calc-result {
    background: linear-gradient(135deg, rgba(13, 59, 58, 0.06), rgba(240, 160, 128, 0.06));
    border: 1px solid rgba(240, 160, 128, 0.3);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}
.calc-result::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient);
}
.calc-result-placeholder {
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
    padding: 20px;
}
.calc-result-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.calc-result-row {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 12px;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 14px;
}
.calc-result-row:last-child { border-bottom: none; }
.calc-result-label { color: var(--text); font-weight: 500; }
.calc-result-formula {
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.calc-result-value {
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}
.calc-result-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 16px;
    border-top: 2px solid var(--accent);
    font-size: 16px;
}
.calc-result-total strong {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.calc-result-note {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(240, 160, 128, 0.12);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text);
    text-align: center;
}

/* CTA */
.calc-cta {
    margin: 48px 0 32px;
}
.calc-cta-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px 32px;
    background: linear-gradient(135deg, rgba(13, 59, 58, 0.1), rgba(240, 160, 128, 0.1));
    border: 1px solid rgba(240, 160, 128, 0.3);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}
.calc-cta-inner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient);
}
.calc-cta-text { flex: 1; min-width: 240px; }
.calc-cta-text strong {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.calc-cta-text span {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* FAQ */
.calc-faq {
    margin: 40px 0;
}
.calc-faq h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

/* Похожие */
.calc-related { margin: 40px 0; }
.calc-related h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}
.calc-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.calc-related-grid-lg {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
/* На десктопе — три колонки в ряд */
@media (min-width: 1024px) {
    .calc-related-grid,
    .calc-related-grid-lg {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
.calc-related-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: transform .2s, border-color .2s, box-shadow .2s;
}
.calc-related-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}
.calc-related-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(240, 160, 128, 0.12);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.calc-related-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.calc-related-body strong {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.calc-related-body span {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Мобильная */
@media (max-width: 900px) {
    .calc-main { padding: 24px 16px 40px; }
}

@media (max-width: 600px) {
    .calc-main { padding: 20px 16px 40px; }
    .calc-form { padding: 20px 16px; }
    .calc-result { padding: 20px 16px; }
    .calc-result-row {
        grid-template-columns: 1fr auto;
        gap: 4px 12px;
    }
    .calc-result-formula {
        grid-column: 1 / -1;
        font-size: 11px;
    }
    .calc-result-total strong { font-size: 22px; }
    .calc-cta-inner { padding: 20px; }
    .calc-cta-inner .btn-primary { width: 100%; justify-content: center; }
    .calc-header h1 { gap: 8px; }
    .calc-header h1 svg { width: 22px; height: 22px; }
}

/* ============================================================
   ПРИЖАТЬ ФУТЕР К НИЗУ
   ============================================================ */
html, body.calc-page {
    min-height: 100%;
    height: 100%;
}

body.calc-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.calc-page .calc-main {
    flex: 1 0 auto;
    min-height: 0;
}

body.calc-page .landing-footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* ============================================================
   КНОПКА ПЕРЕКЛЮЧЕНИЯ ТЕМЫ
   ============================================================ */
.calc-page .btn-theme {
    background: transparent;
    border: 1px solid var(--border-strong);
    cursor: pointer;
    padding: 9px 11px;
    border-radius: 10px;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .15s, border-color .2s, color .2s;
    margin: 0;
    min-width: 0;
    width: auto;
    height: auto;
    font-family: inherit;
    line-height: 1;
}
.calc-page .btn-theme:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    color: var(--accent);
}
.calc-page .btn-theme:active { transform: scale(0.94); }
.calc-page .btn-theme svg { display: block; width: 18px; height: 18px; }

/* ============================================================
   СЕТКИ ПОЛЕЙ — ФИКСИРОВАННОЕ ЧИСЛО КОЛОНОК
   ============================================================ */

.calc-fields-group {
    display: block;
}

.calc-fields-3 {
    grid-template-columns: repeat(3, 1fr);
}
.calc-fields-2 {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 16px;
}
.calc-fields-1 {
    grid-template-columns: 1fr;
}

.calc-fields {
    align-items: start;
}

@media (max-width: 700px) {
    .calc-fields-3,
    .calc-fields-2 {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   СУРБ — рекламные блоки на страницах калькуляторов
   ============================================================ */
.calc-ad-wrap {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 24px 0;
    box-sizing: border-box;
}

.calc-ad-wrap-footer {
    margin-top: 40px;
    margin-bottom: 0;
}

.calc-ad-inline {
    margin: 32px 0;
}

.calc-ad-wrap .ad-block,
.calc-ad-inline .ad-block {
    margin: 0;
}

/* Адаптив */
@media (max-width: 768px) {
    .calc-ad-wrap {
        padding: 16px 16px 0;
        margin-top: 0;
    }
    .calc-ad-inline {
        margin: 24px 0;
    }
    .calc-ad-wrap-footer {
        margin-top: 24px;
    }
}

/* ============================================================
   СТИЛИ ИНТЕРАКТИВНОГО КАЛЬКУЛЯТОРА (DEMO CALC)
   ============================================================ */
.calc-demo-section,
.section-alt {
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.calc-demo-section .section-label {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    margin-bottom: 12px;
}

.calc-demo-section .section-head h2 {
    font-size: clamp(24px, 3.5vw, 36px);
    font-weight: 800;
    color: var(--text);
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.calc-demo-section .section-head p {
    font-size: clamp(14px, 1.8vw, 17px);
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.demo-calc-container {
    max-width: 1600px;
    margin: 32px auto 0;
}

.demo-calc-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-md);
}

.demo-calc-presets {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.demo-preset-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: 4px;
}

.demo-preset-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

html[data-theme="light"] .demo-preset-btn {
    background: #f0ebe4;
    border-color: rgba(13, 59, 58, 0.12);
}

.demo-preset-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.demo-preset-btn.active,
html[data-theme="light"] .demo-preset-btn.active,
html[data-theme="dark"] .demo-preset-btn.active {
    background: var(--accent) !important;
    color: #0d3b3a !important;
    border-color: var(--accent) !important;
}

.demo-slider-group {
    margin-bottom: 20px;
}

.demo-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.demo-slider-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.demo-slider-title svg {
    color: var(--accent);
}

.demo-slider-val {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}

.demo-range {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

html[data-theme="light"] .demo-range {
    background: rgba(13, 59, 58, 0.12);
}

.demo-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s;
}

.demo-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Result Card */
.demo-result-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.demo-result-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.demo-kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.demo-kpi-main {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    margin-top: 2px;
}

.demo-kpi-year {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    margin-top: 2px;
}

.demo-bars-wrap {
    margin-bottom: 20px;
}

.demo-bars-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.demo-bars-stacked {
    height: 12px;
    border-radius: 100px;
    display: flex;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 12px;
}

.demo-bar-seg {
    height: 100%;
    transition: width 0.3s ease;
}

.seg-mgmt  { background: #7fb8a8; }
.seg-heat  { background: #fb923c; }
.seg-light { background: #facc15; }
.seg-water { background: #38bdf8; }
.seg-net   { background: #a855f7; }

.demo-bars-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 12px;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.legend-item strong {
    color: var(--text);
}

.demo-insight-banner {
    background: rgba(240, 160, 128, 0.08);
    border: 1px solid rgba(240, 160, 128, 0.2);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-muted);
    margin-top: auto;
    margin-bottom: 20px;
}

.demo-insight-banner svg {
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.demo-insight-banner strong {
    color: var(--text);
}

.demo-calc-result .btn-primary,
.demo-result-card .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: var(--brand-peach);
    color: #0d3b3a;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(240, 160, 128, 0.35);
}

.demo-calc-result .btn-primary:hover,
.demo-result-card .btn-primary:hover {
    background: var(--brand-peach-2);
    color: #0d3b3a;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(240, 160, 128, 0.45);
}

@media (max-width: 1024px) {
    .demo-calc-grid {
        grid-template-columns: 1fr;
        padding: 24px;
    }
}