/* ═══════════════════════════════════════════════════════════════
   Notification Center — универсальные тосты + панель истории
   ═══════════════════════════════════════════════════════════════ */

:root {
    --notif-primary:        #7C3AED;
    --notif-primary-text:   #5B21B6;
    --notif-primary-bg:     #EDE9FE;
    --notif-primary-border: rgba(124, 58, 237, 0.35);

    /* Цвета категорий */
    --notif-cat-hayd:     #DC2626;
    --notif-cat-iddah:    #7C3AED;
    --notif-cat-islamic:  #059669;
    --notif-cat-personal: #0EA5E9;
    --notif-cat-system:   #6B7280;
    --notif-cat-summary:  #8B5CF6;
}

/* ─── Тост ─── */
.notif-toast {
    position: fixed;
    top: 80px;
    right: 16px;
    width: 400px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
    background: #fff;
    border-inline-start: 4px solid var(--notif-cat-system);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.15);
    padding: 14px 34px 10px 14px;
    border-radius: 8px;
    z-index: 2200;
    font-size: 13px;
    color: #111827;
    animation: notif-toast-in 0.3s ease-out;
    overflow-y: auto;
    cursor: default;
}

/* Категориальный accent (левая полоса) */
.notif-toast-category-hayd     { border-left-color: var(--notif-cat-hayd); }
.notif-toast-category-iddah    { border-left-color: var(--notif-cat-iddah); }
.notif-toast-category-islamic  { border-left-color: var(--notif-cat-islamic); }
.notif-toast-category-personal { border-left-color: var(--notif-cat-personal); }
.notif-toast-category-summary  { border-left-color: var(--notif-cat-summary); }

/* Severity перекрывает категорию (для critical/warning) */
.notif-toast-severity-critical { border-left-color: #DC2626; border-left-width: 5px; }
.notif-toast-severity-warning  { border-left-color: #D97706; }
.notif-toast-severity-success  { border-left-color: #059669; }

.notif-toast-close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: #6B7280;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
    padding: 0;
}

.notif-toast-close:hover {
    background: #F3F4F6;
    color: #111827;
}

.notif-toast-cat {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6B7280;
    margin-bottom: 4px;
    font-weight: 600;
}

.notif-toast-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: #111827;
    font-size: 14px;
    padding-inline-end: 6px;
}

.notif-toast-category-hayd     .notif-toast-title { color: var(--notif-cat-hayd); }
.notif-toast-category-iddah    .notif-toast-title { color: var(--notif-cat-iddah); }
.notif-toast-category-islamic  .notif-toast-title { color: var(--notif-cat-islamic); }
.notif-toast-category-personal .notif-toast-title { color: var(--notif-cat-personal); }

.notif-toast-body {
    white-space: pre-wrap;
    line-height: 1.5;
    color: #374151;
    font-size: 12.5px;
    user-select: text;
    /* Браузер автоматически применяет Scheherazade New / Amiri для арабских глифов
       (latin/кириллица берут первые шрифты из chain). Нужно для корректного
       отображения арабских строк в body тоста (например, такбиры ташрика). */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Scheherazade New', 'Amiri', sans-serif;
}

.notif-toast-link {
    margin-top: 8px;
    font-size: 12px;
}

.notif-toast-link a {
    color: var(--notif-primary-text);
    text-decoration: none;
    font-weight: 600;
}

.notif-toast-link a:hover {
    text-decoration: underline;
}

.notif-toast-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #E5E7EB;
    font-size: 11px;
    color: #6B7280;
}

.notif-toast-history-btn {
    background: transparent;
    border: 1px solid var(--notif-primary-border);
    color: var(--notif-primary-text);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.notif-toast-history-btn:hover { background: var(--notif-primary-bg); }

.notif-toast-timer {
    font-size: 10.5px;
    color: #9CA3AF;
    font-style: italic;
}

@keyframes notif-toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.notif-toast.closing {
    animation: notif-toast-out 0.25s ease-in forwards;
}

@keyframes notif-toast-out {
    to { transform: translateX(120%); opacity: 0; }
}

/* ─── Сводный «Сегодня» — список элементов внутри одного тоста ─── */
.notif-toast-summary {
    border-left-color: var(--notif-cat-summary);
}

.notif-summary-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notif-summary-item {
    padding: 8px 10px;
    border-inline-start: 3px solid #E5E7EB;
    background: #F9FAFB;
    border-radius: 0 4px 4px 0;
    font-size: 12.5px;
}

.notif-summary-cat-hayd     { border-left-color: var(--notif-cat-hayd); }
.notif-summary-cat-iddah    { border-left-color: var(--notif-cat-iddah); }
.notif-summary-cat-islamic  { border-left-color: var(--notif-cat-islamic); }
.notif-summary-cat-personal { border-left-color: var(--notif-cat-personal); }

.notif-summary-item-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 3px;
}

.notif-summary-item-icon { font-size: 14px; }

.notif-summary-item-title { font-size: 12.5px; }

.notif-summary-item-body {
    font-size: 11.5px;
    color: #4B5563;
    line-height: 1.45;
    white-space: pre-wrap;
}

/* ─── Панель истории ─── */
.notif-history-panel {
    display: none;
    position: fixed;
    top: 80px;
    right: 16px;
    width: 440px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
    background: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    z-index: 2300;
    flex-direction: column;
    overflow: hidden;
    animation: notif-toast-in 0.3s ease-out;
}

.notif-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--notif-primary-bg);
    color: var(--notif-primary-text);
    font-weight: 700;
    font-size: 13px;
    border-bottom: 1px solid var(--notif-primary-border);
}

.notif-history-close,
.notif-history-clear {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--notif-primary-text);
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.notif-history-close { font-size: 18px; line-height: 1; }

.notif-history-close:hover,
.notif-history-clear:hover {
    background: rgba(124, 58, 237, 0.15);
}

.notif-history-clear {
    font-size: 11px;
    border: 1px solid var(--notif-primary-border);
}

.notif-history-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px;
}

.notif-history-empty {
    padding: 24px;
    text-align: center;
    color: #9CA3AF;
    font-size: 13px;
}

.notif-history-item {
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #FAFAFA;
    transition: background 0.15s;
}

.notif-history-item.unread {
    background: #FEF3C7;
    border-color: #FDE68A;
}

.notif-history-item:hover { background: #F3F4F6; }

.notif-history-item-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
    gap: 8px;
}

.notif-history-item-cat {
    font-size: 10.5px;
    color: #6B7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.notif-history-item-time {
    font-size: 10.5px;
    color: #9CA3AF;
    white-space: nowrap;
}

.notif-history-item-title {
    font-weight: 700;
    color: #111827;
    font-size: 12.5px;
    margin-bottom: 4px;
}

.notif-history-item-body {
    font-size: 11.5px;
    color: #4B5563;
    white-space: pre-wrap;
    line-height: 1.45;
    max-height: 80px;
    overflow: hidden;
    margin-bottom: 6px;
    position: relative;
}

.notif-history-item-body::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, transparent, #FAFAFA);
    pointer-events: none;
}

.notif-history-item.unread .notif-history-item-body::after {
    background: linear-gradient(to bottom, transparent, #FEF3C7);
}

.notif-history-item:hover .notif-history-item-body::after {
    background: linear-gradient(to bottom, transparent, #F3F4F6);
}

.notif-history-item-reshow {
    font-size: 10.5px;
    background: transparent;
    border: 1px solid var(--notif-primary-border);
    color: var(--notif-primary-text);
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.notif-history-item-reshow:hover { background: var(--notif-primary-bg); }

/* ─── Адаптив ─── */
@media (max-width: 640px) {
    .notif-toast,
    .notif-history-panel {
        left: 8px;
        right: 8px;
        width: auto;
        max-width: none;
        top: 64px;
    }
}
