/* ===== Переменные и базовая палитра ===== */
:root {
    --green: #153F20;
    --green-soft: #2A5F3A;
    --green-light: #E8F0E8;
    --green-bg: #F4F8F4;
    --grey-900: #1A1A1A;
    --grey-700: #444;
    --grey-500: #888;
    --grey-300: #CCC;
    --grey-200: #E5E5E5;
    --grey-100: #F4F4F4;
    --white: #FFF;
    --accent: #B85C00;
    --danger: #B91C1C;
    --warn: #F59E0B;

    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 4px 16px rgba(0,0,0,.06);
}

[data-theme="dark"] {
    --green-bg: #0F1F12;
    --grey-100: #1F1F1F;
    --grey-200: #2A2A2A;
    --grey-700: #BBB;
    --grey-900: #F4F4F4;
    --white: #1A1A1A;
}

/* ===== Сброс и основа ===== */
* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--green-bg);
    color: var(--grey-900);
    font-family: -apple-system, "Inter", "Roboto", sans-serif;
    font-size: 22px;
    line-height: 1.4;
}

/* Стойка — горизонтальная (альбомная) ориентация по ТЗ */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    width: 100vw;
    height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    background: var(--green);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 32px 24px;
    gap: 24px;
}
.sidebar-brand .brand-logo {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
}
.sidebar-brand .brand-sub {
    font-size: 16px;
    opacity: .7;
    margin-top: 4px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 8px; }
.nav-item {
    color: var(--white);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: .8;
    transition: opacity .15s;
}
.nav-item:hover { opacity: 1; background: rgba(255,255,255,.08); }
.nav-icon {
    width: 20px; height: 20px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.icon-home { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M12 3l9 8h-3v9h-4v-6h-4v6H7v-9H4z'/></svg>"); }
.icon-back { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.42-1.41L7.83 13H20z'/></svg>"); }
.icon-help { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z'/></svg>"); }

.sidebar-progress { margin-top: auto; }
.progress-label { font-size: 14px; opacity: .7; margin-bottom: 8px; }
.progress-bar {
    height: 6px;
    background: rgba(255,255,255,.15);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: #6FCF97;
    transition: width .4s;
}
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.15);
    padding-top: 16px;
    font-size: 13px;
    opacity: .6;
    line-height: 1.6;
}

/* ===== Main area ===== */
.main {
    padding: 48px 64px;
    overflow: hidden;
    position: relative;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr minmax(380px, 35%);
    gap: 48px;
    width: 100%;
    height: 100%;
}

/* Заголовок над контентом */
.lead {
    color: var(--grey-500);
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}
h1 {
    color: var(--green);
    font-size: 42px;
    font-weight: 700;
    margin: 0 0 24px;
    line-height: 1.1;
}
h2 { font-size: 28px; color: var(--green); }
h3 { font-size: 22px; color: var(--grey-900); }

/* ===== Левая колонка: контент =====
   В примере это .preloader .questions, у нас обобщённо .content-main */
.content-main {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-right: 24px;
}

/* ===== Правая колонка: видео-диктор по ТЗ =====
   Постоянное окно на ВСЕХ шагах: правая треть экрана (~30–35%). */
.video-pane {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: fit-content;
    align-self: start;
    position: sticky;
    top: 0;
}
.video-pane .video-label {
    color: var(--grey-500);
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.video-wrapper {
    width: 100%;
    aspect-ratio: 9 / 16;          /* вертикальное окно с диктором */
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}
.video-wrapper video,
.video-wrapper .video-js {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* ===== Формы, опции ===== */
.form-group {
    margin-bottom: 24px;
}
.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
    color: var(--grey-700);
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--grey-200);
    border-radius: var(--radius-sm);
    font-size: 20px;
    background: var(--white);
    color: var(--grey-900);
    font-family: inherit;
    transition: border-color .15s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--green);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Радио и чекбоксы — крупные тач-кнопки */
.option-grid {
    display: grid;
    gap: 12px;
}
.option {
    display: block;
}
.option input[type="radio"],
.option input[type="checkbox"] {
    display: none;
}
.option label {
    display: block;
    padding: 18px 22px;
    border: 2px solid var(--grey-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    font-size: 20px;
    color: var(--grey-900);
    transition: all .15s;
}
.option label:hover { border-color: var(--green-soft); }
.option input:checked + label {
    border-color: var(--green);
    background: var(--green-light);
    color: var(--green);
    font-weight: 600;
}

/* Шкала Ликерта — биполярная (САН) */
.scale-bipolar {
    display: grid;
    grid-template-columns: 1fr repeat(7, auto) 1fr;
    align-items: center;
    gap: 6px;
    padding: 12px 0;
    border-bottom: 1px solid var(--grey-200);
}
.scale-bipolar .pole {
    color: var(--grey-700);
    font-size: 18px;
}
.scale-bipolar .pole.left { text-align: right; padding-right: 12px; }
.scale-bipolar .pole.right { padding-left: 12px; }
.scale-bipolar input[type="radio"] { display: none; }
.scale-bipolar label {
    width: 36px; height: 36px;
    border: 2px solid var(--grey-300);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}
.scale-bipolar input:checked + label {
    background: var(--green);
    border-color: var(--green);
    color: var(--white);
}

/* ===== Кнопки управления ===== */
.controls {
    display: flex;
    gap: 16px;
    margin-top: auto;
    padding-top: 32px;
}
.controls.between { justify-content: space-between; }
.btn {
    padding: 18px 36px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--green);
    color: var(--white);
    transition: all .15s;
    font-family: inherit;
}
.btn:hover { background: var(--green-soft); }
.btn.second {
    background: var(--white);
    color: var(--green);
    border: 2px solid var(--green);
}
.btn.second:hover { background: var(--green-light); }
.btn.large {
    padding: 24px 48px;
    font-size: 24px;
}
.btn.disabled, .btn:disabled {
    opacity: .35;
    pointer-events: none;
    cursor: not-allowed;
}

/* ===== Индикатор прибора ===== */
.device-status {
    padding: 24px;
    background: var(--white);
    border-radius: var(--radius);
    border: 2px solid var(--grey-200);
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}
.device-status.state-rdy   { border-color: var(--green); background: var(--green-light); }
.device-status.state-meas  { border-color: var(--warn); background: #FEF3C7; }
.device-status.state-rslt  { border-color: var(--green); background: var(--green-light); }
.device-status.state-err   { border-color: var(--danger); background: #FEE2E2; }
.device-status.state-nrdy  { border-color: var(--grey-300); }
.device-led {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--grey-300);
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
}
.state-rdy .device-led,
.state-rslt .device-led { background: #10B981; animation: none; }
.state-meas .device-led { background: var(--warn); }
.state-err .device-led  { background: var(--danger); animation: none; }

@keyframes pulse {
    0%, 100% { opacity: .6; transform: scale(1); }
    50%      { opacity: 1;  transform: scale(1.15); }
}
.device-text { flex: 1; font-size: 18px; color: var(--grey-700); }
.device-value {
    font-size: 56px;
    font-weight: 700;
    color: var(--green);
    line-height: 1;
}
.device-value-small { font-size: 32px; }
.device-unit { font-size: 18px; color: var(--grey-500); margin-left: 8px; }

/* ===== Карточки результатов ===== */
.result-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.result-card .label { color: var(--grey-500); font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.result-card .value { font-size: 36px; color: var(--green); font-weight: 700; margin-top: 4px; }

/* ===== Прогресс по опроснику внутри одного экрана ===== */
.q-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    font-size: 16px;
    color: var(--grey-500);
}
.q-progress-track {
    flex: 1;
    height: 4px;
    background: var(--grey-200);
    border-radius: 2px;
    overflow: hidden;
}
.q-progress-fill {
    height: 100%;
    background: var(--green);
    transition: width .25s;
}

/* ===== Вопрос-карточка ===== */
.question-item {
    display: none;
    flex: 1;
    flex-direction: column;
}
.question-item.active { display: flex; }
.question-text {
    font-size: 28px;
    color: var(--grey-900);
    margin-bottom: 32px;
    line-height: 1.3;
}

/* ===== Утилиты ===== */
.mt-auto { margin-top: auto; }
.text-grey { color: var(--grey-500); }
.text-small { font-size: 14px; }
.spacer-large { height: 32px; }
