﻿/* =============================================================================
   MEW NOTIFICATION SYSTEM — Government Grade
   - Center modal (matches screenshot)
   - Smart toasts (top-right slide)
   - Bell with pulse + badge animation
   - Notification panel/drawer
   - Mute/DND controls
============================================================================= */

/* ==========================================================================
   1. SWEETALERT POPUP — Government polish (matches your screenshot)
========================================================================== */

/* All MEW-branded SweetAlert popups */
.swal2-popup.mew-swal {
    font-family: 'Cairo', 'Tajawal', 'Rubik', sans-serif !important;
    border-radius: 16px !important;
    padding: 32px 28px 24px !important;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.25), 0 10px 20px rgba(15, 23, 42, 0.1) !important;
    border: 1px solid rgba(31, 78, 121, 0.08) !important;
    max-width: 480px !important;
    direction: rtl;
}

    .swal2-popup.mew-swal .swal2-title {
        font-family: inherit !important;
        font-size: 22px !important;
        font-weight: 800 !important;
        color: #1f2937 !important;
        margin-top: 18px !important;
        margin-bottom: 8px !important;
        line-height: 1.4 !important;
    }

    .swal2-popup.mew-swal .swal2-html-container {
        font-family: inherit !important;
        font-size: 14px !important;
        color: #6b7280 !important;
        line-height: 1.7 !important;
        margin: 8px 0 18px !important;
    }

    .swal2-popup.mew-swal .swal2-actions {
        margin-top: 22px !important;
        gap: 10px !important;
    }

        .swal2-popup.mew-swal .swal2-actions button {
            font-family: inherit !important;
            font-weight: 700 !important;
            font-size: 14px !important;
            padding: 9px 28px !important;
            border-radius: 8px !important;
            min-width: 110px !important;
            transition: all 0.15s ease !important;
        }

            .swal2-popup.mew-swal .swal2-actions button:hover {
                transform: translateY(-1px);
                box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12) !important;
            }

    /* SweetAlert icon refinements */
    .swal2-popup.mew-swal .swal2-icon {
        width: 90px !important;
        height: 90px !important;
        border-width: 3px !important;
        margin: 8px auto 0 !important;
    }

        .swal2-popup.mew-swal .swal2-icon .swal2-icon-content {
            font-size: 50px !important;
        }

/* Success — government green */
.swal2-popup.mew-swal--success .swal2-icon.swal2-success {
    border-color: #16a34a !important;
}

    .swal2-popup.mew-swal--success .swal2-icon.swal2-success [class^=swal2-success-line] {
        background-color: #16a34a !important;
    }

    .swal2-popup.mew-swal--success .swal2-icon.swal2-success .swal2-success-ring {
        border-color: rgba(22, 163, 74, 0.25) !important;
    }

/* Error — refined red */
.swal2-popup.mew-swal--error .swal2-icon.swal2-error {
    border-color: #dc3545 !important;
}

    .swal2-popup.mew-swal--error .swal2-icon.swal2-error [class^=swal2-x-mark-line] {
        background-color: #dc3545 !important;
    }

/* Warning — amber */
.swal2-popup.mew-swal--warning .swal2-icon.swal2-warning {
    border-color: #fd7e14 !important;
    color: #fd7e14 !important;
}

/* Info — government navy */
.swal2-popup.mew-swal--info .swal2-icon.swal2-info {
    border-color: #1f4e79 !important;
    color: #1f4e79 !important;
}

/* Backdrop fade */
.swal2-container.swal2-backdrop-show {
    background: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(4px);
}

/* ==========================================================================
   2. SWEETALERT TOAST (top-end mini notifications)
========================================================================== */

.swal2-popup.mew-toast.swal2-toast {
    font-family: 'Cairo', sans-serif !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15) !important;
    border: 1px solid rgba(15, 23, 42, 0.06) !important;
    direction: rtl;
    padding: 14px 18px !important;
    min-width: 320px;
}

.swal2-popup.mew-toast .swal2-title {
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 700 !important;
}

.swal2-popup.mew-toast .swal2-icon {
    margin-inline-end: 12px !important;
}

.swal2-popup.mew-toast--success {
    border-inline-start: 4px solid #16a34a !important;
}

.swal2-popup.mew-toast--error {
    border-inline-start: 4px solid #dc3545 !important;
}

.swal2-popup.mew-toast--warning {
    border-inline-start: 4px solid #fd7e14 !important;
}

.swal2-popup.mew-toast--info {
    border-inline-start: 4px solid #1f4e79 !important;
}

/* ==========================================================================
   3. NOTIFICATION TOAST CARDS (top-right rich toasts)
========================================================================== */

#notifToastContainer {
    position: fixed;
    top: 80px;
    inset-inline-end: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100vw - 40px);
}

.notif-toast {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15), 0 2px 6px rgba(15, 23, 42, 0.08);
    pointer-events: auto;
    cursor: pointer;
    transform: translateX(0);
    animation: notif-toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    direction: rtl;
    font-family: 'Cairo', sans-serif;
    border-inline-start: 4px solid #1f4e79;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .notif-toast:hover {
        transform: translateX(-2px);
        box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18), 0 4px 10px rgba(15, 23, 42, 0.1);
    }

[dir="ltr"] .notif-toast:hover {
    transform: translateX(2px);
}

.notif-toast.is-leaving {
    animation: notif-toast-out 0.25s ease-in forwards;
}

@keyframes notif-toast-in {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="ltr"] @keyframes notif-toast-in {
    from

{
    opacity: 0;
    transform: translateX(30px);
}

to {
    opacity: 1;
    transform: translateX(0);
}

}

@keyframes notif-toast-out {
    to {
        opacity: 0;
        transform: translateX(-50px);
    }
}

/* Severity colors */
.notif-toast--info {
    border-inline-start-color: #1f4e79;
}

.notif-toast--success {
    border-inline-start-color: #16a34a;
}

.notif-toast--warning {
    border-inline-start-color: #fd7e14;
}

.notif-toast--error {
    border-inline-start-color: #dc3545;
}

.notif-toast--critical {
    border-inline-start-color: #c92a2a;
    box-shadow: 0 10px 30px rgba(201, 42, 42, 0.2), 0 0 0 2px rgba(201, 42, 42, 0.15);
}

.notif-toast__icon {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
}

.notif-toast--info .notif-toast__icon {
    background: linear-gradient(135deg, #1f4e79, #2c6ba8);
}

.notif-toast--success .notif-toast__icon {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.notif-toast--warning .notif-toast__icon {
    background: linear-gradient(135deg, #fd7e14, #c45c08);
}

.notif-toast--error .notif-toast__icon {
    background: linear-gradient(135deg, #dc3545, #a02230);
}

.notif-toast--critical .notif-toast__icon {
    background: linear-gradient(135deg, #c92a2a, #8c1212);
    animation: notif-pulse 1.5s ease-in-out infinite;
}

@keyframes notif-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(201, 42, 42, 0.5);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(201, 42, 42, 0);
    }
}

.notif-toast__body {
    flex: 1;
    min-width: 0;
}

.notif-toast__title {
    font-size: 13.5px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 3px;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notif-toast__message {
    font-size: 12px;
    color: #6b7280;
    margin: 0 0 6px;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notif-toast__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #9ca3af;
}

    .notif-toast__meta i {
        font-size: 13px;
    }

.notif-toast__close {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    align-self: flex-start;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    padding: 0;
    transition: all 0.15s ease;
}

    .notif-toast__close:hover {
        background: #f3f4f6;
        color: #1f2937;
    }

/* Progress bar at bottom */
.notif-toast__progress {
    position: absolute;
    bottom: 0;
    inset-inline-start: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    border-radius: 0 0 12px 12px;
    transition: width linear;
}

.notif-toast {
    position: relative;
    overflow: hidden;
}



/* ==========================================================================
   5. NOTIFICATION SETTINGS PANEL (mute/sound/DND controls)
========================================================================== */

#notifSettingsBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
}

    #notifSettingsBtn:hover {
        background: #f3f4f6;
        color: #1f4e79;
        border-color: #e2e8f0;
    }

    #notifSettingsBtn.is-muted {
        color: #dc3545;
    }

.notif-settings-popup {
    position: absolute;
    top: 50px;
    inset-inline-end: 0;
    z-index: 9999;
    width: 280px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.18);
    padding: 14px;
    direction: rtl;
}

.notif-settings-popup__title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .notif-settings-popup__title i {
        color: #1f4e79;
    }

.notif-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
    color: #1f2937;
}

    .notif-setting-row + .notif-setting-row {
        border-top: 1px solid #f3f4f6;
    }

    .notif-setting-row label {
        flex: 1;
        margin: 0;
        cursor: pointer;
        font-weight: 600;
    }

.notif-setting-row__hint {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}

/* Toggle switch */
.notif-toggle {
    position: relative;
    width: 38px;
    height: 22px;
    background: #cbd5e1;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease;
    border: none;
    flex: 0 0 38px;
    padding: 0;
}

    .notif-toggle::after {
        content: '';
        position: absolute;
        top: 2px;
        inset-inline-end: 2px;
        width: 18px;
        height: 18px;
        background: #fff;
        border-radius: 50%;
        transition: inset-inline-end 0.2s ease;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }

    .notif-toggle.is-on {
        background: #16a34a;
    }

        .notif-toggle.is-on::after {
            inset-inline-end: 18px;
        }

/* Volume slider */
.notif-volume {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #e2e8f0;
    border-radius: 999px;
    outline: none;
    margin-top: 4px;
}

    .notif-volume::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 14px;
        height: 14px;
        background: #1f4e79;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(31, 78, 121, 0.3);
    }

    .notif-volume::-moz-range-thumb {
        width: 14px;
        height: 14px;
        background: #1f4e79;
        border-radius: 50%;
        cursor: pointer;
        border: none;
    }

/* DND status pill */
.notif-dnd-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #fef3c7;
    color: #78350f;
    border: 1px solid #fde68a;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 10px;
}

    .notif-dnd-status.is-active {
        background: #fee2e2;
        color: #991b1b;
        border-color: #fecaca;
    }

/* ==========================================================================
   6. RESPONSIVE
========================================================================== */

@media (max-width: 768px) {
    #notifToastContainer {
        top: 70px;
        inset-inline-start: 12px;
        inset-inline-end: 12px;
        max-width: none;
    }

    .notif-toast {
        padding: 12px;
    }

    .swal2-popup.mew-swal {
        padding: 24px 20px !important;
        margin: 12px !important;
    }

        .swal2-popup.mew-swal .swal2-title {
            font-size: 18px !important;
        }

    .notif-settings-popup {
        position: fixed;
        top: 60px;
        inset-inline-end: 12px;
        inset-inline-start: 12px;
        width: auto;
    }
}

/* ==========================================================================
   7. DARK MODE
========================================================================== */

html[data-theme="dark"] .swal2-popup.mew-swal,
.dark-style .swal2-popup.mew-swal {
    background: #1e293b !important;
    border-color: #334155 !important;
}

    html[data-theme="dark"] .swal2-popup.mew-swal .swal2-title,
    .dark-style .swal2-popup.mew-swal .swal2-title {
        color: #e2e8f0 !important;
    }

    html[data-theme="dark"] .swal2-popup.mew-swal .swal2-html-container,
    .dark-style .swal2-popup.mew-swal .swal2-html-container {
        color: #94a3b8 !important;
    }

html[data-theme="dark"] .notif-toast,
.dark-style .notif-toast {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

html[data-theme="dark"] .notif-toast__title,
.dark-style .notif-toast__title {
    color: #e2e8f0;
}

html[data-theme="dark"] .notif-toast__message,
.dark-style .notif-toast__message {
    color: #94a3b8;
}

html[data-theme="dark"] .notif-settings-popup,
.dark-style .notif-settings-popup {
    background: #1e293b;
    border-color: #334155;
}

html[data-theme="dark"] .notif-setting-row,
.dark-style .notif-setting-row {
    color: #e2e8f0;
}

/* ==========================================================================
   8. REDUCED MOTION
========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .notif-toast,
    #notifBadge,
    #notifBell,
    .notif-toast--critical .notif-toast__icon {
        animation: none !important;
    }
}
