/* ==========================================================================
   Notificaciones Globales — Campana + Panel + Toast en tiempo real
   Se importa en todas las páginas ptr-page
   ========================================================================== */

/* === BELL BUTTON (in topbar) === */
.notif-bell-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    color: var(--text-secondary, #94a3b8);
    font-size: 1.2rem;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all .2s;
}
.notif-bell-btn:hover {
    color: var(--text-primary, #f1f5f9);
    background: rgba(14,165,233,.1);
    border-color: rgba(14,165,233,.3);
}
.notif-bell-btn.has-unread {
    color: #0ea5e9;
    animation: bellPulse 2s infinite;
}
@keyframes bellPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
.notif-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--dark-bg, #0f172a);
}
.notif-bell-badge.visible {
    display: flex;
}

/* === DROPDOWN PANEL === */
.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 380px;
    max-height: 480px;
    background: var(--dark-surface, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,.4);
    z-index: 200;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: notifPanelIn .2s ease;
}
.notif-panel.open {
    display: flex;
}
@keyframes notifPanelIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--border-color, #334155);
}
.notif-panel-header h4 {
    margin: 0;
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
    display: flex;
    align-items: center;
    gap: 6px;
}
.notif-panel-header h4 i { color: #0ea5e9; }
.notif-mark-read-btn {
    background: none;
    border: none;
    color: #0ea5e9;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all .2s;
}
.notif-mark-read-btn:hover {
    background: rgba(14,165,233,.1);
}

/* List */
.notif-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: .5rem;
}
.notif-panel-list::-webkit-scrollbar { width: 4px; }
.notif-panel-list::-webkit-scrollbar-track { background: transparent; }
.notif-panel-list::-webkit-scrollbar-thumb { background: rgba(148,163,184,.2); border-radius: 4px; }

/* Item */
.notif-item {
    display: flex;
    gap: .65rem;
    padding: .7rem .75rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
    color: inherit;
}
.notif-item:hover {
    background: rgba(14,165,233,.06);
}
.notif-item.unread {
    background: rgba(14,165,233,.05);
}
.notif-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.notif-icon-mercado {
    background: rgba(14,165,233,.12);
    color: #38bdf8;
}
.notif-icon-banco {
    background: rgba(34,197,94,.12);
    color: #22c55e;
}
.notif-icon-policia {
    background: rgba(239,68,68,.12);
    color: #ef4444;
}
.notif-icon-sistema {
    background: rgba(168,85,247,.12);
    color: #c084fc;
}
.notif-icon-trabajo {
    background: rgba(245,158,11,.12);
    color: #fbbf24;
}
.notif-icon-default {
    background: rgba(148,163,184,.1);
    color: #94a3b8;
}
.notif-item-content {
    flex: 1;
    min-width: 0;
}
.notif-item-msg {
    font-size: .82rem;
    color: var(--text-primary, #f1f5f9);
    line-height: 1.35;
    margin: 0 0 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notif-item.unread .notif-item-msg { font-weight: 600; }
.notif-item-time {
    font-size: .7rem;
    color: var(--text-secondary, #94a3b8);
}
.notif-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0ea5e9;
    flex-shrink: 0;
    align-self: center;
    display: none;
}
.notif-item.unread .notif-unread-dot { display: block; }

/* Empty */
.notif-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary, #94a3b8);
}
.notif-empty i { font-size: 2rem; opacity: .3; display: block; margin-bottom: .5rem; }
.notif-empty p { margin: 0; font-size: .85rem; }

/* === LIVE TOAST (bottom-right pop-up on new notification) === */
.notif-live-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.notif-toast-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1.1rem;
    background: var(--dark-surface, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-left: 4px solid #0ea5e9;
    border-radius: 12px;
    box-shadow: 0 10px 35px rgba(0,0,0,.35);
    min-width: 300px;
    max-width: 420px;
    pointer-events: auto;
    animation: toastSlideIn .35s ease;
    cursor: pointer;
    transition: opacity .3s, transform .3s;
}
.notif-toast-item.removing {
    opacity: 0;
    transform: translateX(100%);
}
@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}
.notif-toast-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.notif-toast-body {
    flex: 1;
    min-width: 0;
}
.notif-toast-title {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #0ea5e9;
    margin-bottom: 2px;
}
.notif-toast-msg {
    font-size: .82rem;
    color: var(--text-primary, #f1f5f9);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notif-toast-close {
    background: none;
    border: none;
    color: var(--text-secondary, #94a3b8);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px;
    opacity: .5;
    transition: opacity .2s;
}
.notif-toast-close:hover { opacity: 1; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .notif-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
    }
    .notif-live-toast {
        bottom: 12px;
        right: 12px;
        left: 12px;
    }
    .notif-toast-item { min-width: auto; }
}

