/* ═══════════════════════════════════════════════════════════════════════════
   notifications.css  —  Teacher-Data in-app notification system styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── NAVBAR BUTTONS ────────────────────────────────────────────────────────
   Bell, Notify, and ALERT button sizing / alignment in the dark navbar
───────────────────────────────────────────────────────────────────────────── */

.nav-notif-btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.65rem;
    letter-spacing: 0.02em;
}

.nav-emergency-btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    animation: emergencyBtnPulse 3s ease-in-out infinite;
}

@keyframes emergencyBtnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.5); }
    50%       { box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
}

/* ─── NOTIFICATION BELL ─────────────────────────────────────────────────────
   Bell icon with animated unread badge
───────────────────────────────────────────────────────────────────────────── */

.notif-bell-wrapper {
    position: relative;
}

.notif-bell-btn {
    position: relative;
    font-size: 1.05rem;
    padding: 0.35rem 0.5rem;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 0px;
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    min-width: 17px;
    height: 17px;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
    animation: badgePop 0.3s ease;
    border: 1.5px solid #343a40; /* matches navbar bg-dark */
}

@keyframes badgePop {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ─── NOTIFICATION DROPDOWN ─────────────────────────────────────────────────
   Bell dropdown — fixed width, scrollable list
───────────────────────────────────────────────────────────────────────────── */

.notif-dropdown {
    width: 340px;
    max-width: 95vw;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.notif-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
}

.notif-item {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    cursor: default;
    transition: background 0.15s;
}

.notif-item:hover {
    background: #f8f9fa;
}

.notif-item.unread {
    background: #fffbe6;
    border-left: 3px solid #ffc107;
}

.notif-item.unread:hover {
    background: #fff8d6;
}

.notif-item.is-emergency {
    border-left: 3px solid #dc3545;
    background: #fff5f5;
}

.notif-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.notif-item-sender {
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
}

.notif-item-time {
    font-size: 0.72rem;
    color: #595959;
}

.notif-item-msg {
    font-size: 0.82rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.notif-item-type-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 3px;
}

.badge-lockdown1 { background: #f8d7da; color: #721c24; }
.badge-lockdown2 { background: #dc3545; color: #fff; }
.badge-lockdown3 { background: #7c0a10; color: #fff; }
.badge-tornado   { background: #fff3cd; color: #856404; }
.badge-regular   { background: #e2e3e5; color: #383d41; }

.notif-empty {
    text-align: center;
    color: #595959;
    padding: 20px 0;
    font-size: 0.85rem;
}

/* ─── MAC-STYLE TOAST NOTIFICATIONS ─────────────────────────────────────────
   Appear in the top-right corner; slide in from the right.
   Stack vertically if multiple arrive.
───────────────────────────────────────────────────────────────────────────── */

#toastContainer {
    position: fixed;
    top: 70px;   /* below navbar */
    right: 18px;
    z-index: 9500;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* container transparent to clicks */
    max-width: 360px;
    width: 100%;
}

.notif-toast {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.16), 0 1px 4px rgba(0,0,0,0.08);
    overflow: hidden;
    pointer-events: all;
    animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-left: 5px solid #0d6efd;
    min-width: 280px;
}

.notif-toast.fade-out {
    animation: toastSlideOut 0.3s ease forwards;
}

.notif-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 6px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.notif-toast-icon {
    font-size: 0.9rem;
    margin-right: 6px;
    color: #0d6efd;
}

.notif-toast-sender {
    font-weight: 700;
    font-size: 0.85rem;
    color: #1a1a2e;
    flex: 1;
}

.notif-toast-time {
    font-size: 0.72rem;
    color: #595959;
    margin-right: 8px;
}

.notif-toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #595959;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s;
}

.notif-toast-close:hover { color: #333; }

.notif-toast-body {
    padding: 10px 14px;
    font-size: 0.875rem;
    color: #333;
    line-height: 1.45;
}

@keyframes toastSlideIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toastSlideOut {
    from { transform: translateX(0);    opacity: 1; max-height: 200px; margin-bottom: 0; }
    to   { transform: translateX(110%); opacity: 0; max-height: 0;     margin-bottom: -10px; }
}

/* ─── EMERGENCY OVERLAYS ─────────────────────────────────────────────────────
   Lockdown Level 1 — top banner (small, ~18vh)
   Lockdown Level 2 — centred panel (~60% screen)
   Lockdown Level 3 — full screen, pulsing
   Tornado          — centred panel, yellow
───────────────────────────────────────────────────────────────────────────── */

/* ── Shared overlay styles ── */
.emergency-overlay {
    position: fixed;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.4s ease;
}

.emergency-overlay.fade-out {
    animation: overlayFadeOut 0.5s ease forwards;
}

@keyframes overlayFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes overlayFadeOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.95); }
}

.emergency-overlay-content {
    text-align: center;
    padding: 30px 40px;
    max-width: 90%;
}

.emergency-overlay-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
    display: block;
    animation: iconPulse 1.2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.12); }
}

.emergency-overlay-title {
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 14px;
    line-height: 1.1;
}

.emergency-overlay-msg {
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 20px;
}

.emergency-overlay-sender {
    font-size: 0.85rem;
    opacity: 0.75;
    margin-bottom: 8px;
}

.emergency-overlay-sub {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 22px;
    font-style: italic;
}

.emergency-dismiss-btn {
    border: 2px solid currentColor;
    background: rgba(255,255,255,0.15);
    color: inherit;
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 0.04em;
}

.emergency-dismiss-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* ── Lockdown Level 1 — narrow top banner ── */
.emergency-lockdown1 {
    top: 0;
    left: 0;
    right: 0;
    min-height: 100px;
    max-height: 22vh;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    animation: overlayFadeIn 0.4s ease, levelOnePulse 2.5s ease-in-out 0.4s infinite;
}

.emergency-lockdown1 .emergency-overlay-icon   { font-size: 2.2rem; margin-bottom: 4px; }
.emergency-lockdown1 .emergency-overlay-title  { font-size: clamp(1.1rem, 3vw, 1.6rem); }
.emergency-lockdown1 .emergency-overlay-msg    { font-size: clamp(0.78rem, 2vw, 1rem); }
.emergency-lockdown1 .emergency-overlay-sender { display: none; } /* space-saver for banner */

@keyframes levelOnePulse {
    0%, 100% { background: linear-gradient(135deg, #c0392b, #e74c3c); }
    50%       { background: linear-gradient(135deg, #a93226, #cb4335); }
}

/* ── Lockdown Level 2 — centred modal panel ── */
.emergency-lockdown2 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    width: min(80vw, 700px);
    min-height: 320px;
    border-radius: 20px;
    background: linear-gradient(135deg, #b03a2e, #e74c3c);
    color: #fff;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.55), 0 0 40px rgba(0,0,0,0.5);
    animation: overlayFadeIn 0.4s ease, levelTwoPulse 1.8s ease-in-out 0.4s infinite;
}

.emergency-lockdown2 .emergency-overlay-title { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.emergency-lockdown2 .emergency-overlay-msg   { font-size: clamp(0.95rem, 2.5vw, 1.2rem); }

@keyframes levelTwoPulse {
    0%, 100% { box-shadow: 0 0 0 100vmax rgba(0,0,0,0.55), 0 0 40px rgba(0,0,0,0.5); }
    50%       { box-shadow: 0 0 0 100vmax rgba(0,0,0,0.65), 0 0 60px rgba(200,0,0,0.4); }
}

/* ── Lockdown Level 3 — full screen ── */
.emergency-lockdown3 {
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #b71c1c;
    color: #fff;
    animation: overlayFadeIn 0.3s ease, levelThreePulse 1s ease-in-out 0.3s infinite;
}

.emergency-lockdown3 .emergency-overlay-icon  { font-size: 5rem; }
.emergency-lockdown3 .emergency-overlay-title { font-size: clamp(2rem, 6vw, 4rem); }
.emergency-lockdown3 .emergency-overlay-msg   { font-size: clamp(1.1rem, 3vw, 1.7rem); }

@keyframes levelThreePulse {
    0%, 100% { background: #b71c1c; }
    50%       { background: #7f0000; }
}

/* ── Tornado / Severe Weather — yellow panel ── */
.emergency-tornado {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    width: min(80vw, 700px);
    min-height: 300px;
    border-radius: 20px;
    background: linear-gradient(135deg, #e6a817, #f7c948);
    color: #2d2000;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.5), 0 0 40px rgba(0,0,0,0.35);
    animation: overlayFadeIn 0.4s ease, tornadoPulse 2s ease-in-out 0.4s infinite;
}

.emergency-tornado .emergency-overlay-title     { color: #2d2000; }
.emergency-tornado .emergency-dismiss-btn       { border-color: #2d2000; color: #2d2000; }
.emergency-tornado .emergency-dismiss-btn:hover { background: rgba(0,0,0,0.12); }

@keyframes tornadoPulse {
    0%, 100% { background: linear-gradient(135deg, #e6a817, #f7c948); }
    50%       { background: linear-gradient(135deg, #d4960e, #e8b830); }
}

/* ─── EMERGENCY MODAL — CARD GRID ────────────────────────────────────────────
   The four pre-filled emergency type cards inside #emergencyModal
───────────────────────────────────────────────────────────────────────────── */

.emergency-card {
    border-radius: 12px;
    padding: 18px 16px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    height: 100%;
    user-select: none;
    position: relative;
}

.emergency-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

.emergency-card:active {
    transform: translateY(0);
}

.emergency-card-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.emergency-card-title {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.emergency-card-msg {
    font-size: 0.8rem;
    line-height: 1.45;
    opacity: 0.85;
}

/* Lockdown 1 — light red */
.lockdown1-card {
    background: #fde8e8;
    border: 2px solid #f5b7b1;
    color: #78281f;
}
.lockdown1-card:hover { background: #fad7d7; }

/* Lockdown 2 — medium red */
.lockdown2-card {
    background: #e74c3c;
    border: 2px solid #c0392b;
    color: #fff;
}
.lockdown2-card:hover { background: #c0392b; }

/* Lockdown 3 — dark red */
.lockdown3-card {
    background: #922b21;
    border: 2px solid #641e16;
    color: #fff;
}
.lockdown3-card:hover { background: #7b241c; }

/* Tornado — yellow */
.tornado-card {
    background: #fef9e7;
    border: 2px solid #f9ca24;
    color: #7d6608;
}
.tornado-card:hover { background: #fef3cd; }

/* Sending spinner overlay on card */
.emergency-card.sending::after {
    content: '📡 Sending…';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 12px;
}

/* ─── COMPOSE MODAL — TEACHER CHECKBOX LIST ──────────────────────────────────
   Scrollable checkbox list of teachers in the compose modal
───────────────────────────────────────────────────────────────────────────── */

.notif-teacher-list {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding: 4px 0;
}

.notif-teacher-list .teacher-option {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.notif-teacher-list .teacher-option:hover {
    background: #f0f4ff;
}

.notif-teacher-list .teacher-option input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 15px;
    height: 15px;
}

.notif-teacher-list .teacher-option label {
    margin: 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
}

/* ─── HISTORY MODAL LIST ─────────────────────────────────────────────────────
   Notification history rows inside the history modal
───────────────────────────────────────────────────────────────────────────── */

.history-item {
    padding: 12px 18px;
    border-bottom: 1px solid #f0f0f0;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item.is-emergency {
    background: #fff5f5;
    border-left: 4px solid #dc3545;
}

.history-item.is-tornado {
    background: #fffbe6;
    border-left: 4px solid #ffc107;
}

.history-item .history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.history-item .history-sender {
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
}

.history-item .history-time {
    font-size: 0.75rem;
    color: #595959;
}

.history-item .history-msg {
    font-size: 0.875rem;
    color: #555;
    line-height: 1.4;
}
