/* ══════════════════════════════════════════════════════════════════
   KinoDron — msgbox (ошибки / успех / инфо) — премиум 2026
   Стиль: карточка с иконкой, градиентным заголовком, pill-кнопкой
   Зависимости: styles.css (--accent, --surface, --line, --radius, ...)
   ══════════════════════════════════════════════════════════════════ */

/* ─── Фон страницы (blur-круги + лучи) ────────────────────────── */
body:has(.error)::before,
body:has(.berrors)::before,
body:has(.msgbox)::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 60% 50% at 20% 15%, rgba(160,0,255,.16), transparent 60%),
        radial-gradient(ellipse 50% 40% at 85% 85%, rgba(206,94,255,.12), transparent 60%);
    pointer-events: none;
}

/* ─── Контейнер карточки ──────────────────────────────────────── */
.error,
.berrors,
.berrors2,
.msgbox,
.dle-msgbox {
    position: relative;
    display: block;
    width: 100%;
    max-width: 560px;
    margin: clamp(110px, 14vw, 180px) auto clamp(50px, 7vw, 90px);
    padding: clamp(32px, 5vw, 52px) clamp(24px, 4vw, 44px);
    box-sizing: border-box;

    background:
        linear-gradient(135deg, rgba(160,0,255,.04) 0%, rgba(206,94,255,.02) 100%),
        var(--surface, #141418);
    border: 1px solid var(--line2, rgba(244,241,236,.14));
    border-radius: calc(var(--radius, 16px) + 4px);
    color: var(--text, #F4F1EC);
    font-family: var(--sans, "Manrope", system-ui, sans-serif);
    font-size: 15px;
    line-height: 1.65;
    text-align: center;
    overflow: hidden;

    box-shadow:
        0 40px 80px -32px rgba(160,0,255,.45),
        0 16px 32px -12px rgba(0,0,0,.6),
        inset 0 1px 0 rgba(255,255,255,.03);

    animation: kinoMsgAppear .65s cubic-bezier(.2,.8,.2,1);
}

@keyframes kinoMsgAppear {
    from { opacity: 0; transform: translateY(28px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Градиентная полоска сверху */
.error::before,
.berrors::before,
.berrors2::before,
.msgbox::before,
.dle-msgbox::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--accent, #a000ff) 0%,
        var(--accent2, #ce5eff) 50%,
        var(--accent3, #e4a8ff) 100%);
    background-size: 200% 100%;
    animation: kinoMsgStripe 4s ease-in-out infinite;
}

@keyframes kinoMsgStripe {
    0%, 100% { background-position: 0% 0%; }
    50%      { background-position: 100% 0%; }
}

/* ─── Иконка в круглом контейнере ─────────────────────────────── */
.error__icon,
.berrors__icon,
.msgbox__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background:
        linear-gradient(135deg, rgba(160,0,255,.18), rgba(206,94,255,.10));
    border: 1px solid rgba(160,0,255,.3);
    position: relative;
    animation: kinoMsgIconPulse 3s ease-in-out infinite;
}

.error__icon i,
.berrors__icon i,
.msgbox__icon i {
    font-size: 30px;
    background: linear-gradient(135deg, var(--accent, #a000ff), var(--accent2, #ce5eff));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error__icon::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid rgba(160,0,255,.15);
    animation: kinoMsgRing 3s ease-in-out infinite;
}

@keyframes kinoMsgIconPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(160,0,255,.4); }
    50%      { box-shadow: 0 0 0 14px rgba(160,0,255,0); }
}
@keyframes kinoMsgRing {
    0%, 100% { transform: scale(1); opacity: .6; }
    50%      { transform: scale(1.12); opacity: 0; }
}

/* fallback если нет своей иконки — используем ::after на контейнере */
.error:not(:has(.error__icon))::after,
.berrors:not(:has(.berrors__icon))::after,
.msgbox:not(:has(.msgbox__icon))::after {
    content: '⚠';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
    background: linear-gradient(135deg, rgba(160,0,255,.18), rgba(206,94,255,.10));
    border: 1px solid rgba(160,0,255,.3);
    color: var(--accent2, #ce5eff);
    animation: kinoMsgIconPulse 3s ease-in-out infinite;
}

/* ─── Заголовок (Playfair Display — элегантность) ────────────── */
.error__title,
.error b,
.error strong,
.berrors b,
.berrors strong,
.berrors h1,
.berrors h4,
.berrors2 b,
.berrors2 strong,
.msgbox b,
.msgbox strong,
.dle-msgbox b {
    display: block;
    font-family: var(--serif, "Playfair Display", Georgia, serif);
    font-size: clamp(22px, 3.2vw, 30px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.015em;
    margin: 0 0 14px;
    background: linear-gradient(135deg, var(--text, #F4F1EC) 0%, var(--accent3, #e4a8ff) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Скрыть дубликат крестика в заголовке */
.error__title--i,
.error .icon-close {
    display: none !important;
}

/* ─── Контент ─────────────────────────────────────────────────── */
.error__content,
.berrors p,
.berrors2 p,
.msgbox p,
.dle-msgbox p {
    display: block;
    color: var(--soft, #CFCAC2);
    font-size: 15px;
    line-height: 1.7;
    margin: 0 0 8px;
}

/* ─── Список ошибок ───────────────────────────────────────────── */
.error ul,
.berrors ul,
.berrors2 ul,
.msgbox ul {
    list-style: none;
    padding: 0;
    margin: 22px 0 0;
    text-align: left;
}
.error ul li,
.berrors ul li,
.berrors2 ul li,
.msgbox ul li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin: 8px 0;
    background: rgba(228,168,255,.06);
    border-left: 3px solid var(--negative, #e4a8ff);
    border-radius: 10px;
    color: var(--soft, #CFCAC2);
    font-size: 14px;
    line-height: 1.55;
    animation: kinoMsgItemAppear .4s ease-out backwards;
}
.error ul li:nth-child(1) { animation-delay: .1s; }
.error ul li:nth-child(2) { animation-delay: .18s; }
.error ul li:nth-child(3) { animation-delay: .26s; }

.error ul li::before {
    content: '•';
    color: var(--negative, #e4a8ff);
    font-weight: 700;
    flex-shrink: 0;
}

@keyframes kinoMsgItemAppear {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ─── Кнопки (pill + градиент + блик) ────────────────────────── */
.error a,
.berrors a,
.berrors2 a,
.msgbox a,
.dle-msgbox a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 13px 28px;
    background: linear-gradient(135deg, var(--accent, #a000ff) 0%, var(--accent2, #ce5eff) 100%);
    color: #fff !important;
    border-radius: 999px;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .25s ease;
    box-shadow: 0 8px 24px -8px rgba(160,0,255,.55),
                inset 0 1px 0 rgba(255,255,255,.15);
}
.error a::before,
.berrors a::before,
.msgbox a::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
    transition: left .5s ease;
}
.error a:hover,
.berrors a:hover,
.msgbox a:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px -8px rgba(160,0,255,.75),
                inset 0 1px 0 rgba(255,255,255,.25);
}
.error a:hover::before,
.berrors a:hover::before,
.msgbox a:hover::before {
    left: 100%;
}

/* ─── Модификаторы: success / info ───────────────────────────── */
.msgbox--success,
.berrors--success {
    border-color: rgba(124,196,148,.28);
    background:
        linear-gradient(135deg, rgba(124,196,148,.06) 0%, rgba(124,196,148,.02) 100%),
        var(--surface, #141418);
}
.msgbox--success::before,
.berrors--success::before {
    background: linear-gradient(90deg, #7cc494, #a9d9bc, #7cc494);
}
.msgbox--success b,
.msgbox--success .msgbox__title {
    background: linear-gradient(135deg, var(--text, #F4F1EC) 0%, #7cc494 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.msgbox--success a {
    background: linear-gradient(135deg, #4a9d6a, #7cc494);
    box-shadow: 0 8px 24px -8px rgba(124,196,148,.55);
}

/* ─── Светлая тема ───────────────────────────────────────────── */
[data-theme="light"] body:has(.error)::before,
[data-theme="light"] body:has(.berrors)::before,
[data-theme="light"] body:has(.msgbox)::before {
    background:
        radial-gradient(ellipse 60% 50% at 20% 15%, rgba(160,0,255,.08), transparent 60%),
        radial-gradient(ellipse 50% 40% at 85% 85%, rgba(206,94,255,.06), transparent 60%);
}
[data-theme="light"] .error,
[data-theme="light"] .berrors,
[data-theme="light"] .berrors2,
[data-theme="light"] .msgbox,
[data-theme="light"] .dle-msgbox {
    background:
        linear-gradient(135deg, rgba(160,0,255,.03) 0%, rgba(206,94,255,.01) 100%),
        #ffffff;
    border-color: #e5e5ea;
    color: #1a1a1f;
    box-shadow:
        0 24px 48px -20px rgba(160,0,255,.12),
        0 8px 24px -8px rgba(0,0,0,.08);
}
[data-theme="light"] .error__title,
[data-theme="light"] .error b,
[data-theme="light"] .berrors b,
[data-theme="light"] .msgbox b {
    background: linear-gradient(135deg, #1a1a1f 0%, var(--accent, #a000ff) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
[data-theme="light"] .error__content,
[data-theme="light"] .berrors p,
[data-theme="light"] .msgbox p {
    color: #4a4a52;
}
[data-theme="light"] .error ul li {
    background: rgba(160,0,255,.05);
    color: #3a3a3f;
}

/* ─── Мобила ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .error, .berrors, .berrors2, .msgbox, .dle-msgbox {
        margin: clamp(100px, 16vw, 140px) var(--pad, 16px) clamp(40px, 6vw, 60px);
        padding: 28px 22px;
        border-radius: var(--radius, 16px);
    }
    .error__title, .berrors b, .msgbox b { font-size: 21px; }
    .error__content, .berrors p, .msgbox p { font-size: 14px; }
    .error a, .berrors a, .msgbox a {
        width: 100%;
        justify-content: center;
        margin-top: 20px;
    }
}

/* ─── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .error, .berrors, .berrors2, .msgbox, .dle-msgbox,
    .error::before, .error::after,
    .berrors::before, .msgbox::before,
    .error__icon, .error__icon::after {
        animation: none !important;
    }
    .error a, .error a::before { transition: none !important; }
}
