/* Частные стили модуля «Комплектовщик». Каркас — studia-ui.css, подключается после этого файла. */

/* AdminLTE отодвигает футер под свой сайдбар, которого здесь нет.
   В AdminLTE 3.2 селектор body:not(.sidebar-mini-md):not(.sidebar-mini-xs):not(.layout-top-nav) .main-footer
   специфичнее любого разумного своего, поэтому !important (замер: без него margin-left 250px). */
body .main-content .main-footer {
    margin-left: 0 !important;
}

/* Исходный <select> под select2 должен сразу стать невидимой точкой 1×1. У .form-control в studia-ui
   стоит transition: all — сжатие шло анимацией и в неотрисованной вкладке застывало на полной ширине,
   скрытый select вылезал за правый край (замер: 1087px вместо 1px). */
.main-content select.form-control.select2-hidden-accessible {
    transition: none !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
}

/* Поле поиска внутри мультивыбора select2 4.1 — textarea, и AdminLTE рисует ему собственную рамку:
   внутри поля появлялась вторая рамка с подсказкой. Поле должно сливаться с контейнером. */
.main-content .select2-container .select2-search--inline .select2-search__field {
    border: 0 !important;
    box-shadow: none !important;
    outline: 0;
    background: transparent;
    font-family: inherit;
    margin-top: 7px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text, #1e293b);
    margin: 0 0 20px;
}

.card-header .card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.card-hint {
    font-size: 13px;
    color: var(--text-light, #64748b);
    margin: 4px 0 0;
}

/* Таблица сопоставлений: первая строка «по умолчанию» выделена */
.table-map tr.row-default td {
    background: rgba(37, 99, 235, .04);
    font-weight: 600;
}

.table-map td {
    vertical-align: middle;
}

.table-map td:first-child {
    width: 34%;
}

/* Список чекбоксов с прокруткой: склады, магазины, формы */
.check-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: 8px 12px;
}

.check-list .custom-control {
    margin: 4px 0;
}

.check-list-actions {
    font-size: 13px;
    margin: 6px 0 0;
}

.check-list-actions a {
    margin-right: 12px;
}

.reveal-block {
    margin: 10px 0 0 26px;
    padding-left: 14px;
    border-left: 2px solid var(--border, #e2e8f0);
}

.badge-level-info { background: #e0f2fe; color: #0369a1; }
.badge-level-warning { background: #fef3c7; color: #92400e; }
.badge-level-error { background: #fee2e2; color: #b91c1c; }

.copy-group .form-control[readonly] {
    background: #f8fafc;
}

.deadline-inputs {
    display: flex;
    gap: 10px;
    max-width: 420px;
}

.deadline-inputs .input-group {
    flex: 1;
}

.actions-cell {
    white-space: nowrap;
    text-align: right;
}

.actions-cell form {
    display: inline;
}

/* Страницы без сайдбара: подключение, вход сборщика, модуль не активен */
.guest-body {
    background: var(--background, #f8fafc);
}

.guest-wrap {
    max-width: 460px;
    margin: 60px auto;
    padding: 0 16px;
}

.guest-logo {
    text-align: center;
    margin-bottom: 24px;
}

.guest-logo img {
    max-width: 200px;
}

.guest-card {
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06);
}

.guest-card .card-body {
    padding: 28px;
}

.guest-card h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 16px;
}

.guest-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-light, #64748b);
    margin-top: 20px;
}

/* Шаблоны: редактор письма, галерея макетов, превью страницы опроса */
.template-editor {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.preset-preview {
    position: relative;
    height: 300px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background: #f3f4f6;
    border-radius: 12px 12px 0 0;
}

/* Письмо шириной 600px показывается уменьшенным, без прокрутки и кликов. */
.preset-preview iframe {
    width: 640px;
    height: 720px;
    border: 0;
    transform: scale(.42);
    transform-origin: 0 0;
    pointer-events: none;
}

.page-preview {
    display: flex;
    justify-content: center;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 8px;
}

.page-preview iframe {
    width: 100%;
    height: 720px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    transition: width .2s;
}

/* Отчёт «Ответы» */
.report-filters select {
    min-width: 180px;
}

.stat-tile .stat-label {
    font-size: 13px;
    color: var(--text-light);
}

.stat-tile .stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

.stat-tile .stat-hint {
    font-size: 12px;
    color: var(--text-light);
}

.is-detractors { background: #ef4444; }
.is-passives { background: #f59e0b; }
.is-promoters { background: #10b981; }

.nps-split {
    display: flex;
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
    background: var(--border);
}

.nps-split-legend {
    gap: 16px;
    margin: 8px 0 24px;
    font-size: 13px;
    color: var(--text-light);
}

.nps-split-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border-radius: 2px;
}

.nps-bars {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 8px;
    height: 180px;
}

.nps-bar {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.nps-bar-count {
    font-size: 12px;
    color: var(--text-light);
}

.nps-bar-fill {
    width: 100%;
    min-height: 2px;
    border-radius: 4px 4px 0 0;
}

.nps-bar-label {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 600;
}

.badge-nps-danger { background: #fee2e2; color: #b91c1c; }
.badge-nps-warning { background: #fef3c7; color: #92400e; }
.badge-nps-success { background: #d1fae5; color: #047857; }

.js-sortable th[data-sort] {
    cursor: pointer;
    user-select: none;
}

.js-sortable th.sort-asc::after { content: ' ▲'; }
.js-sortable th.sort-desc::after { content: ' ▼'; }

/* Подсказка по переменным письма */
.variables-hint {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(37, 99, 235, .03);
}

.variables-hint summary {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

.variables-group {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-light);
}

.variables-hint td {
    padding: 2px 4px;
    font-size: 13px;
    vertical-align: middle;
}
