/* ============================================================
   Оповещения пользователю: колокольчик в шапке, выпадающая панель
   и тост о возврате средств (по центру экрана).
   Стили общие для светлой и тёмной темы — цвета из переменных app.css.
   ============================================================ */

.notice-wrap { position: relative; display: inline-flex; }

.notice-btn { position: relative; }
.notice-btn.has-unread {
    background: var(--accent-soft);
    border-color: var(--accent-soft);
    color: var(--accent-text);
}
.notice-btn.has-unread svg { animation: noticeRing 2.4s ease-in-out 2; }

.notice-count {
    position: absolute;
    top: -2px; right: -2px;
    min-width: 17px; height: 17px;
    padding: 0 4px;
    display: grid; place-items: center;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 10.5px; font-weight: 800; line-height: 1;
    box-shadow: 0 0 0 2px var(--shell);
}
.notice-count[hidden] { display: none; }

/* ---------- Панель ---------- */
.notice-panel {
    position: fixed;
    top: 60px;
    left: 0;
    width: min(370px, calc(100vw - 24px));
    padding: 8px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 26px 60px -22px rgba(14, 18, 26, .35);
    z-index: 90;
}
.notice-panel[hidden] { display: none; }

.notice-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 6px 8px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.notice-head-actions { display: inline-flex; align-items: center; gap: 6px; }
.notice-readall {
    border: 0; cursor: pointer;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 11.5px; font-weight: 700;
    white-space: nowrap;
    transition: background .14s ease, color .14s ease;
}
.notice-readall:hover { background: var(--accent); color: #fff; }
.notice-readall[disabled] {
    background: var(--surface-3);
    color: var(--muted);
    cursor: default;
}
.notice-clear {
    border: 0; cursor: pointer;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 11.5px; font-weight: 700;
    white-space: nowrap;
    transition: background .14s ease, color .14s ease;
}
.notice-clear:hover { background: var(--red-soft); color: var(--red); }
.notice-clear[hidden] { display: none; }

.notice-list {
    max-height: min(58vh, 380px);
    overflow: auto;
    display: flex; flex-direction: column; gap: 2px;
    padding-bottom: 2px;
}

.notice-item {
    display: flex; gap: 10px;
    padding: 10px;
    padding-right: 26px;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    transition: background .14s ease;
    flex: 1 1 auto;
    min-width: 0;
}
.notice-item:hover { background: var(--surface-2); }

/* Строка списка: ссылка/текст + крестик удаления */
.notice-row {
    position: relative;
    display: flex;
    align-items: stretch;
    border-radius: 14px;
    transition: opacity .16s ease, transform .16s ease;
}
.notice-row.is-out { opacity: 0; transform: translateX(8px); }

.notice-del {
    position: absolute;
    top: 6px; right: 6px;
    width: 20px; height: 20px;
    display: grid; place-items: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity .14s ease, background .14s ease, color .14s ease;
}
.notice-row:hover .notice-del,
.notice-del:focus-visible { opacity: 1; }
.notice-del:hover { background: var(--red-soft); color: var(--red); }
/* На телефоне наведения нет — крестик виден всегда */
@media (hover: none) {
    .notice-del { opacity: .75; background: var(--surface-3); }
}

.notice-ic {
    width: 30px; height: 30px; flex: none;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--surface-3);
    color: var(--text-2);
}
.notice-item--refund .notice-ic { background: var(--green-soft); color: var(--green); }
.notice-item--topup .notice-ic { background: var(--green-soft); color: var(--green); }
.notice-item--done .notice-ic { background: var(--blue-soft); color: var(--blue); }
.notice-item--support .notice-ic { background: var(--blue-soft); color: var(--blue); }
.notice-item--fail .notice-ic { background: var(--red-soft); color: var(--red); }
.notice-item--low .notice-ic { background: var(--red-soft); color: var(--red); }
.notice-item--promo .notice-ic { background: var(--accent-soft); color: var(--accent-text); }
.notice-item--task .notice-ic { background: var(--blue-soft); color: var(--blue); }

.notice-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notice-title {
    display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
    font-size: 13px; font-weight: 700; color: var(--text);
}
.notice-item.is-unread .notice-title { font-weight: 800; }
.notice-item.is-unread .notice-title::before {
    content: '';
    width: 6px; height: 6px; flex: none;
    border-radius: 50%;
    background: var(--accent);
}
.notice-sum {
    font-size: 11px; font-weight: 800;
    padding: 1px 7px; border-radius: 999px;
    background: var(--green-soft); color: var(--green);
}
.notice-text { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.notice-time { font-size: 11px; color: var(--muted); }

.notice-empty {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 24px 10px;
    color: var(--muted); font-size: 12.5px;
}
.notice-empty[hidden] { display: none; }

/* ---------- Тост по центру экрана (плоский стиль) ---------- */
.toast-stack {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 95;
    display: flex; flex-direction: column; gap: 10px;
    width: min(430px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex; gap: 13px;
    align-items: flex-start;
    padding: 18px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    animation: toastIn .2s ease both;
}
.toast.is-out { animation: toastOut .18s ease forwards; }
.toast-ic {
    width: 40px; height: 40px; flex: none;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--green-soft); color: var(--green);
}
.toast--done .toast-ic { background: var(--blue-soft); color: var(--blue); }
.toast--support .toast-ic { background: var(--blue-soft); color: var(--blue); }
.toast--fail .toast-ic,
.toast--low .toast-ic { background: var(--red-soft); color: var(--red); }
.toast--promo .toast-ic,
.toast--referral .toast-ic { background: var(--accent-soft); color: var(--accent-text); }
.toast-ic svg { width: 20px; height: 20px; }
.toast-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.toast-title { font-size: 14.5px; font-weight: 800; color: var(--text); line-height: 1.3; }
.toast-text { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.toast-actions {
    display: flex; gap: 8px; margin-top: 10px;
}
.toast-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    box-shadow: none;
}
.toast-x {
    margin: -4px -4px 0 auto;
    align-self: flex-start;
    border: 0; background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 5px; border-radius: 8px;
    line-height: 0;
}
.toast-x:hover { background: var(--surface-2); color: var(--text); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
@keyframes noticeRing {
    0%, 60%, 100% { transform: rotate(0); }
    10%, 30%, 50% { transform: rotate(-9deg); }
    20%, 40% { transform: rotate(9deg); }
}

@media (max-width: 600px) {
    /* На телефоне панель — почти на всю ширину, позицию считает notices.js */
    .notice-panel { width: calc(100vw - 20px); }
    .notice-list { max-height: min(64vh, 320px); }
    .toast { padding: 16px; border-radius: 16px; }
    .toast-actions .btn { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .toast, .notice-btn.has-unread svg { animation: none !important; transition: none !important; }
}
