/* ===== ИИ-предмодерация: плашки, тумблеры, таблица настроек, модалка =====
   Стили глобальные, а не scoped в компоненте, потому что плашки живут внутри
   карточек модерации, которые прилетают готовым HTML и вставляются через
   v-html — scoped-атрибуты на такую разметку не попадают. */

/* ---------- Плашка статуса в карточке материала ---------- */
.premod-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: 'GolosText-Regular';
    font-weight: 400;
    font-size: 13px;
    line-height: 130%;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.premod-chip:hover {
    filter: brightness(0.96);
}

/* Тот же чип, но как подпись внутри модалки — кликать не по чему. */
.premod-chip--static {
    cursor: default;
}

.premod-chip--static:hover {
    filter: none;
}

.premod-chip::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.premod-chip--pending {
    background: #D6E6F8;
    border-color: #b9d3f0;
    color: #2C5282;
}

.premod-chip--passed {
    background: #D7E9C5;
    border-color: #c0dba7;
    color: #3F6126;
}

.premod-chip--failed {
    background: #FAD7DD;
    border-color: #f0bcc6;
    color: #B0354B;
}

/* «Замечание» — вердикт warning: проверено не всё, но отклонять не за что. */
.premod-chip--warning {
    background: #F7E3B8;
    border-color: #eacf94;
    color: #8A5A12;
}

/* Строка «Предмодерация: <плашка>» под статусом модерации в списках. */
.premod-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.premod-line__label {
    font-family: 'GolosText-Regular';
    font-size: 13px;
    line-height: 130%;
    color: rgba(51, 51, 51, 0.7);
}

/* В таблицах чип под чипом статуса — своей строкой. */
.premod-line--stacked {
    display: flex;
    margin-top: 6px;
}

/* ---------- Тумблер ---------- */
.premod-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-family: 'GolosText-Regular';
    font-size: 14px;
    line-height: 130%;
    color: var(--textPrimary);
}

.premod-switch__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.premod-switch__track {
    position: relative;
    flex: none;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: rgba(64, 53, 40, 0.22);
    transition: background 0.18s ease;
}

.premod-switch__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease;
}

.premod-switch__input:checked + .premod-switch__track {
    background: var(--textPrimaryBase);
}

.premod-switch__input:checked + .premod-switch__track::after {
    transform: translateX(18px);
}

.premod-switch__input:focus-visible + .premod-switch__track {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Тумблер, который не читается: выключен главный тумблер или тумблер колонки. */
.premod-switch--muted {
    opacity: 0.45;
}

.premod-switch--muted .premod-switch__input:checked + .premod-switch__track {
    background: rgba(64, 53, 40, 0.45);
}

.premod-switch__input:disabled + .premod-switch__track {
    cursor: default;
}

/* ---------- Раздел настроек ---------- */
.premod-settings__master {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.premod-settings__note {
    margin: 0;
    font-family: 'GolosText-Regular';
    font-size: 13px;
    line-height: 150%;
    color: rgba(51, 51, 51, 0.7);
}

.premod-settings__warning {
    margin-top: 16px;
    padding: 12px 16px;
    border: 1px solid #f2d998;
    border-radius: 10px;
    background: #fff6e5;
    color: #8c6300;
    font-family: 'GolosText-Regular';
    font-size: 13px;
    line-height: 150%;
}

.premod-settings__table {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
}

.premod-settings__table th,
.premod-settings__table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    font-family: 'GolosText-Regular';
    font-size: 14px;
    line-height: 140%;
}

.premod-settings__table thead th {
    border-bottom: 1px solid rgba(64, 53, 40, 0.24);
    vertical-align: bottom;
}

.premod-settings__col-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.premod-settings__col-title {
    font-family: 'GolosText-Regular';
    font-weight: 500;
    color: var(--textPrimary);
}

.premod-settings__toggle-cell {
    width: 220px;
}

/* Колонка «автоприём» гаснет, пока у раздела выключена предмодерация. */
.premod-settings__cell--locked {
    opacity: 0.45;
}

.premod-settings__section-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 140%;
    color: rgba(51, 51, 51, 0.65);
}

.premod-settings__state {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    line-height: 140%;
    color: rgba(51, 51, 51, 0.6);
}

/* ---------- Дубль тумблеров внутри раздела модерации ---------- */
.premod-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    margin: 16px 0 4px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.premod-inline__title {
    font-family: 'GolosText-Regular';
    font-weight: 500;
    font-size: 14px;
    color: var(--textPrimary);
    margin-right: auto;
}

.premod-inline__link {
    font-family: 'GolosText-Regular';
    font-size: 13px;
    color: var(--hoverPrimaryLight);
    text-decoration: underline;
}

/* ---------- Модалка с разбором проверки ---------- */
.premod-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.45);
}

.premod-modal__dialog {
    width: 100%;
    max-width: 640px;
    padding: 24px;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.premod-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.premod-modal__title {
    margin: 0;
    font-family: 'Lora-SemiBold';
    font-size: 20px;
    line-height: 130%;
    color: var(--ink);
}

.premod-modal__close {
    flex: none;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(64, 53, 40, 0.08);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: var(--ink);
}

.premod-modal__block {
    margin-top: 18px;
}

.premod-modal__label {
    display: block;
    margin-bottom: 6px;
    font-family: 'GolosText-Regular';
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(51, 51, 51, 0.6);
}

.premod-modal__text {
    margin: 0;
    font-family: 'GolosText-Regular';
    font-size: 14px;
    line-height: 150%;
    color: var(--textPrimary);
}

.premod-modal__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.premod-modal__tag {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(61, 86, 50, 0.1);
    font-family: 'GolosText-Regular';
    font-size: 12px;
    line-height: 140%;
    color: var(--textPrimaryBase);
}

.premod-modal__issues {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.premod-modal__issue {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--warning);
    border-radius: 10px;
    background: #fff;
}

.premod-modal__issue--high {
    border-left-color: var(--danger);
}

.premod-modal__issue-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    font-family: 'GolosText-Regular';
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

.premod-modal__issue-where {
    font-weight: 400;
    color: rgba(51, 51, 51, 0.65);
}

.premod-modal__issue-message {
    margin: 6px 0 0;
    font-family: 'GolosText-Regular';
    font-size: 14px;
    line-height: 150%;
    color: var(--textPrimary);
}

.premod-modal__request-id {
    font-family: monospace;
    font-size: 12px;
    color: rgba(51, 51, 51, 0.6);
    word-break: break-all;
}

@media (max-width: 767.98px) {
    .premod-settings__table,
    .premod-settings__table thead,
    .premod-settings__table tbody,
    .premod-settings__table tr,
    .premod-settings__table th,
    .premod-settings__table td {
        display: block;
    }

    .premod-settings__table thead {
        display: none;
    }

    .premod-settings__table tr {
        padding: 8px 0;
        border-bottom: 1px solid var(--line);
    }

    .premod-settings__table td {
        border-bottom: none;
        padding: 8px 0;
    }

    .premod-settings__toggle-cell {
        width: auto;
    }
}

/* «Ошибка проверки» — ИИ был недоступен. Не отказ: нейтрально-серый, не красный,
   чтобы модератор не спутал его с «не прошёл». */
.premod-chip--error {
    background: #E6E3DD;
    border-color: #d3cec5;
    color: #5c5851;
}

/* Чип статуса модерации, по которому открывается проверка ИИ. Выглядит как
   обычный чип — добавляется только курсор и лёгкая подсветка. */
.status-chip--openable {
    border: 1px solid transparent;
    font: inherit;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.status-chip--openable:hover {
    filter: brightness(0.96);
}

/* ---------- Действия в модалке отчёта ---------- */
.premod-modal__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.premod-modal__hint {
    margin: 0;
    font-family: 'GolosText-Regular';
    font-size: 13px;
    line-height: 150%;
    color: rgba(51, 51, 51, 0.65);
}

.premod-modal__error {
    margin: 12px 0 0;
    padding: 10px 12px;
    border: 1px solid #f0c9c8;
    border-radius: 8px;
    background: #fbe9e8;
    color: #a6312e;
    font-family: 'GolosText-Regular';
    font-size: 13px;
    line-height: 150%;
}

/* ---------- Спиннер ожидания ---------- */
.premod-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(61, 86, 50, 0.25);
    border-top-color: var(--textPrimaryBase);
    border-radius: 50%;
    animation: premod-spin 0.7s linear infinite;
    flex: none;
}

@keyframes premod-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .premod-spinner { animation-duration: 2s; }
}

.premod-waiting {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'GolosText-Regular';
    font-size: 13px;
    color: rgba(51, 51, 51, 0.7);
}
