/*
 * Окно подтверждения — public/js/cw-confirm.js.
 *
 * Селекторы кнопок двойные (.cwc .cwc__btn): в app.css есть глобальные
 * правила для кнопок и полей, и одиночный класс им проигрывал бы.
 */

html.cwc-lock { overflow: hidden; }

.cwc {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    font-family: inherit;
}

.cwc[hidden] { display: none !important; }

.cwc__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .18s ease;
}

.cwc__dialog {
    position: relative;
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    padding: 28px 28px 22px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 64px -12px rgba(15, 23, 42, .35), 0 0 0 1px rgba(15, 23, 42, .06);
    text-align: left;
    opacity: 0;
    transform: translateY(8px) scale(.97);
    transition: opacity .18s ease, transform .24s cubic-bezier(.2, .9, .3, 1.15);
}

.cwc.is-open .cwc__backdrop { opacity: 1; }
.cwc.is-open .cwc__dialog { opacity: 1; transform: none; }

.cwc__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    border-radius: 14px;
}

.cwc__icon svg { width: 24px; height: 24px; }

.cwc--default .cwc__icon { background: #dbeafe; color: #2563eb; }
.cwc--danger .cwc__icon { background: #fee2e2; color: #dc2626; }
.cwc--warning .cwc__icon { background: #fef3c7; color: #d97706; }

.cwc .cwc__title {
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: -.01em;
    color: #0f172a;
}

.cwc .cwc__text {
    margin: 8px 0 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: #475569;
    white-space: pre-line;
}

.cwc .cwc__text[hidden] { display: none; }

.cwc__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.cwc .cwc__btn {
    -webkit-appearance: none;
    appearance: none;
    height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s, box-shadow .15s, transform .1s;
}

.cwc .cwc__btn:active { transform: scale(.98); }
.cwc .cwc__btn:focus { outline: none; }
.cwc .cwc__btn:focus-visible { box-shadow: 0 0 0 3px rgba(37, 99, 235, .4); }

.cwc .cwc__btn--ghost { background: #f1f5f9; color: #334155; }
.cwc .cwc__btn--ghost:hover { background: #e2e8f0; }

.cwc .cwc__btn--ok { background: #2563eb; color: #fff; }
.cwc .cwc__btn--ok:hover { background: #1d4ed8; }

.cwc--danger .cwc__btn--ok { background: #dc2626; }
.cwc--danger .cwc__btn--ok:hover { background: #b91c1c; }
.cwc--danger .cwc__btn--ok:focus-visible { box-shadow: 0 0 0 3px rgba(220, 38, 38, .4); }

.cwc--warning .cwc__btn--ok { background: #d97706; }
.cwc--warning .cwc__btn--ok:hover { background: #b45309; }
.cwc--warning .cwc__btn--ok:focus-visible { box-shadow: 0 0 0 3px rgba(217, 119, 6, .4); }

/* ---------------------------------------------------- тёмная тема */

.cwc--dark .cwc__backdrop { background: rgba(2, 6, 23, .65); }

.cwc--dark .cwc__dialog {
    background: #1e293b;
    box-shadow: 0 24px 64px -12px rgba(0, 0, 0, .6), 0 0 0 1px rgba(148, 163, 184, .14);
}

.cwc--dark .cwc__title { color: #f1f5f9; }
.cwc--dark .cwc__text { color: #94a3b8; }

.cwc--dark.cwc--default .cwc__icon { background: rgba(59, 130, 246, .18); color: #60a5fa; }
.cwc--dark.cwc--danger .cwc__icon { background: rgba(239, 68, 68, .18); color: #f87171; }
.cwc--dark.cwc--warning .cwc__icon { background: rgba(245, 158, 11, .18); color: #fbbf24; }

.cwc--dark .cwc__btn--ghost { background: #334155; color: #e2e8f0; }
.cwc--dark .cwc__btn--ghost:hover { background: #475569; }
.cwc--dark.cwc--default .cwc__btn--ok { background: #3b82f6; }
.cwc--dark.cwc--default .cwc__btn--ok:hover { background: #2563eb; }

/* ---------------------------------------------------------- узкий экран */

@media (max-width: 480px) {
    .cwc__dialog { padding: 24px 20px 18px; }
    .cwc__actions { flex-direction: column-reverse; }
    .cwc .cwc__btn { width: 100%; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    .cwc__backdrop,
    .cwc__dialog { transition: none; }
}
