/* ==========================================
   ДОУ Обследование — Основные стили
   ========================================== */

:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #eff6ff;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-border: #e2e8f0;
    --color-border-hover: #cbd5e1;
    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-warning: #d97706;
    --color-warning-bg: #fffbeb;
    --color-danger: #dc2626;
    --color-danger-bg: #fef2f2;
    --color-green: #16a34a;
    --color-green-bg: #dcfce7;
    --color-yellow: #ca8a04;
    --color-yellow-bg: #fef9c3;
    --color-red: #dc2626;
    --color-red-bg: #fee2e2;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --transition: 0.2s ease;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg) url('../images/background.jpg') center/cover no-repeat fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================
   Header
   ========================================== */

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 40px;
    height: 64px;
    display: flex;
    align-items: center;
    width: 100%;
}

.site-header__inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    text-decoration: none;
    color: var(--color-text);
}

.site-logo__text {
    font-size: 18px;
    font-weight: 700;
}

.site-header__nav {
    display: flex;
    gap: 16px;
    align-items: center;
}

.site-header__link {
    font-size: 14px;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.site-header__link:hover {
    color: var(--color-text);
    text-decoration: none;
}

.site-header__link--logout {
    color: var(--color-danger);
}

/* ==========================================
   Footer
   ========================================== */

.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 24px 40px;
    margin-top: auto;
    width: 100%;
}

.site-footer__inner {
    width: 100%;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 13px;
}

/* ==========================================
   Home Page
   ========================================== */

.page-home {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 40px;
}

.page-home__inner {
    max-width: 1400px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 64px;
    align-items: center;
}

.page-home__title {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 20px;
    color: var(--color-text);
}

.page-home__description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
}

.page-home__goal {
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    margin: 0;
}

.page-home__goal strong {
    font-weight: 700;
}

.page-home__actions {
    margin: 24px 0 0;
}

/* ==========================================
   Auth Card
   ========================================== */

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.auth-card__tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--color-border);
}

.auth-card__tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
}

.auth-card__tab--active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.auth-card__tab:hover:not(.auth-card__tab--active) {
    color: var(--color-text);
}

.auth-card__message {
    margin-bottom: 12px;
    font-size: 13px;
    min-height: 20px;
}

.auth-card__message--error {
    color: var(--color-danger);
}

.auth-card__message--success {
    color: var(--color-success);
}

/* ==========================================
   Forms
   ========================================== */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: var(--font-sans);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder {
    color: var(--color-text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ==========================================
   Buttons
   ========================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
    text-decoration: none;
}

.btn--primary {
    background: var(--color-primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--color-primary-hover);
    text-decoration: none;
}

.btn--secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn--secondary:hover {
    background: var(--color-bg);
    border-color: var(--color-border-hover);
    text-decoration: none;
}

.btn--danger {
    background: var(--color-danger);
    color: #fff;
}

.btn--danger:hover {
    background: #b91c1c;
    text-decoration: none;
}

.btn--small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn--full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================
   Dashboard
   ========================================== */

.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 40px;
    width: 100%;
}

.dashboard__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard__title {
    font-size: 24px;
    font-weight: 700;
}

.dashboard__breadcrumbs {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
}

.dashboard__breadcrumbs a {
    color: var(--color-primary);
}

/* ==========================================
   Cards / Tables
   ========================================== */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card + .card {
    margin-top: 16px;
}

.card__title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

.data-table th {
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--color-primary-light);
}

.data-table__actions {
    display: flex;
    gap: 8px;
}

/* ==========================================
   Status indicators
   ========================================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status--none {
    background: var(--color-bg);
    color: var(--color-text-secondary);
}

.status--green {
    background: var(--color-green-bg);
    color: var(--color-green);
}

.status--yellow {
    background: var(--color-yellow-bg);
    color: var(--color-yellow);
}

.status--red {
    background: var(--color-red-bg);
    color: var(--color-red);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status--green .status-dot { background: var(--color-green); }
.status--yellow .status-dot { background: var(--color-yellow); }
.status--red .status-dot { background: var(--color-red); }
.status--none .status-dot { background: var(--color-text-secondary); }

/* ==========================================
   Modal
   ========================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay--active {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal__title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal__actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ==========================================
   Assessment Form
   ========================================== */

.assessment-form {
    max-width: 1200px;
    margin: 0 auto;
}

.assessment-section {
    margin-bottom: 32px;
}

.assessment-section__title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
}

.screening-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.screening-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    vertical-align: top;
}

.screening-table .col-num {
    width: 3.5rem;
    text-align: center;
    color: var(--color-text-secondary);
    font-weight: 600;
}

.screening-table td:last-child {
    width: 10rem;
    text-align: center;
    vertical-align: middle;
}

.yes-no-toggle {
    display: inline-flex;
    gap: 8px;
    justify-content: center;
}

.yes-no-toggle__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.yes-no-toggle__btn input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.yes-no-toggle__btn:hover {
    border-color: var(--color-primary);
}

/* Нейтральное выделение: без «красного/зелёного» смысла да/нет */
.yes-no-toggle__btn:has(input:checked) {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.radio-group {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 14px;
}

.section-table {
    width: 100%;
    border-collapse: collapse;
}

.section-table th {
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    background: var(--color-primary-light);
    border-bottom: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.section-table th:first-child {
    text-align: left;
    width: 40px;
}

.section-table th:nth-child(2) {
    text-align: left;
    width: auto;
}

.section-table td {
    padding: 8px;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
    vertical-align: top;
}

.section-table td:first-child {
    text-align: center;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.section-table td.option-cell {
    text-align: center;
    vertical-align: middle;
    width: 18%;
}

.section-table td.option-cell label {
    display: block;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius);
    transition: background var(--transition);
    font-size: 12px;
    line-height: 1.4;
}

.section-table td.option-cell label:hover {
    background: var(--color-primary-light);
}

.section-table td.option-cell input[type="radio"] {
    display: block;
    margin: 0 auto 4px;
}

.section-table tr:hover td {
    background: rgba(37, 99, 235, 0.02);
}

/* Просмотр обследования: фиксированные доли колонок (критерий / ответ) */
.section-table--view {
    table-layout: fixed;
}

.section-table--view .section-table__col-num {
    width: 2.75rem;
}

.section-table--view .section-table__col-criterion {
    width: 40%;
}

.section-table--view .section-table__col-answer {
    width: 60%;
}

.section-table--view .section-table__answer-cell {
    font-size: 12px;
    color: var(--color-text-secondary);
    word-wrap: break-word;
}

/* ==========================================
   Empty state
   ========================================== */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-secondary);
}

.empty-state__icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state__text {
    font-size: 15px;
    margin-bottom: 16px;
}

/* ==========================================
   Alerts / Messages
   ========================================== */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert--success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid currentColor;
}

.alert--error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid currentColor;
}

.alert--warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid currentColor;
}

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 768px) {
    .page-home__inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .page-home__title {
        font-size: 28px;
    }

    .page-home {
        padding: 24px 16px;
    }

    .auth-card {
        padding: 24px;
    }

    .dashboard {
        padding: 20px 16px;
    }

    .dashboard__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }

    .section-table {
        font-size: 12px;
    }

    .section-table td.option-cell label {
        font-size: 11px;
    }

    .choice-option {
        grid-template-columns: 2.5rem 1fr;
        gap: 8px;
        padding: 10px;
    }

    .yes-no-toggle__btn {
        min-width: 48px;
        padding: 8px 12px;
    }
}

.assessment-section__hint {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin: -8px 0 16px;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.choice-option {
    display: grid;
    grid-template-columns: 3.5rem 1fr;
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.choice-option:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.choice-option:has(.choice-option__input:checked) {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.choice-option__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.choice-option__num {
    font-weight: 700;
    color: var(--color-text-secondary);
    font-size: 14px;
}

.choice-option__text {
    font-size: 14px;
    line-height: 1.45;
}

/* Таблицы ответов при просмотре: одинаковые ширины колонок во всех блоках */
.assessment-answers-table {
    table-layout: fixed;
    width: 100%;
}

.assessment-answers-table .col-num {
    width: 3.5rem;
    text-align: center;
    vertical-align: top;
}

.assessment-answers-table .col-answer,
.assessment-answers-table .col-mark {
    width: 5.5rem;
    text-align: center;
    vertical-align: top;
}

.assessment-answers-table .col-text {
    width: auto;
    word-wrap: break-word;
}

.data-table tr.row-selected {
    background: rgba(76, 175, 80, 0.08);
}

.recommendation-block {
    max-height: 400px;
    overflow-y: auto;
}

.recommendation-text {
    font-size: 14px;
    line-height: 1.55;
    color: var(--color-text);
}

.recommendation-text p {
    margin: 0 0 12px;
}

.recommendation-text p:last-child {
    margin-bottom: 0;
}

.recommendation-text ul {
    margin: 0 0 12px;
    padding-left: 1.25em;
}

.recommendation-text li {
    margin-bottom: 6px;
}

.recommendation-text strong {
    font-weight: 600;
}

/* 2 этап скрининга */
.form2-choice {
    display: block;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    border: 2px solid var(--color-border);
    cursor: pointer;
    font-size: 14px;
    line-height: 1.45;
}

.form2-choice input {
    margin-right: 8px;
}

.form2-meta-option {
    font-size: 14px;
    line-height: 1.45;
}
