/* ============================================================
   NOTIFICATION BANNER SYSTEM — Public Facing
   Supports: top banner, centered popup, bottom-right toast
   ============================================================ */

/* ── Type Color Variables ── */
:root {
    --notif-info-from: #3b82f6;
    --notif-info-to: #2dd4bf;
    --notif-info-rgb: 59, 130, 246;

    --notif-promo-from: #a855f7;
    --notif-promo-to: #f43f5e;
    --notif-promo-rgb: 168, 85, 247;

    --notif-warning-from: #f59e0b;
    --notif-warning-to: #ef4444;
    --notif-warning-rgb: 245, 158, 11;

    --notif-update-from: #10b981;
    --notif-update-to: #3b82f6;
    --notif-update-rgb: 16, 185, 129;

    /* Dynamic banner offset */
    --pg-banner-height: 0px;
}

body.page-admin {
    margin-top: 0 !important;
}

/* Offset standard public pages */
body:not(.page-admin) {
    margin-top: var(--pg-banner-height, 0px) !important;
    transition: margin-top 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body:not(.page-admin) .navbar {
    top: var(--pg-banner-height, 0px) !important;
    transition: top 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Shared Base ── */
.pg-notif {
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
    box-sizing: border-box;
    z-index: 10000;
    --_from: var(--notif-info-from);
    --_to: var(--notif-info-to);
    --_rgb: var(--notif-info-rgb);
}

.pg-notif[data-type="info"]    { --_from: var(--notif-info-from);    --_to: var(--notif-info-to);    --_rgb: var(--notif-info-rgb); }
.pg-notif[data-type="promo"]   { --_from: var(--notif-promo-from);   --_to: var(--notif-promo-to);   --_rgb: var(--notif-promo-rgb); }
.pg-notif[data-type="warning"] { --_from: var(--notif-warning-from); --_to: var(--notif-warning-to); --_rgb: var(--notif-warning-rgb); }
.pg-notif[data-type="update"]  { --_from: var(--notif-update-from);  --_to: var(--notif-update-to);  --_rgb: var(--notif-update-rgb); }

.pg-notif-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--_from);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.pg-notif-icon .material-icons-round {
    font-size: 20px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.pg-notif-body {
    flex: 1;
    min-width: 0;
}

.pg-notif-title {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 0.98rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 4px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.pg-notif-message {
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pg-notif-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 16px;
    background: #ffffff !important;
    color: #0f172a !important;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.pg-notif-cta:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.pg-notif-dismiss {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.pg-notif-dismiss:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.pg-notif-dismiss .material-icons-round {
    font-size: 18px;
}


/* ── Notification Images ── */

/* Thumbnail (replaces icon when image_url is set) */
.pg-notif-thumb {
    height: 42px;
    width: auto;
    max-width: 100px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.pg-notif-thumb:hover {
    transform: scale(1.04);
}

/* Shared image base */
.pg-notif-image {
    display: block;
    width: 100%;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.4s ease;
}

.pg-notif-image:hover {
    transform: scale(1.02);
}

/* Banner: compact inline image */
.pg-notif-image-banner {
    max-height: 60px;
    margin-top: 8px;
    border-radius: 8px;
}

/* Popup: prominent full-width image */
.pg-notif-image-popup {
    max-height: 200px;
    border-radius: 14px;
    margin: 0;
}

/* Toast: small inline image */
.pg-notif-image-toast {
    max-height: 50px;
    margin-top: 6px;
    border-radius: 8px;
}

/* ================================================================
   1. TOP BANNER
   ================================================================ */
.pg-notif-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    background: rgba(15, 22, 42, 0.45) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 
        0 10px 40px -10px rgba(0, 0, 0, 0.5), 
        0 0 20px rgba(var(--_rgb), 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
    transform: translateY(-100%);
    animation: pgNotifSlideDown 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.3s;
    opacity: 0;
}

.pg-notif-banner.pg-notif-hiding {
    animation: pgNotifSlideUp 0.4s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* Left gradient accent bar - removed for cleaner designer aesthetic */
.pg-notif-banner::before {
    display: none;
}

@keyframes pgNotifSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

@keyframes pgNotifSlideUp {
    from { transform: translateY(0); opacity: 1; }
    to   { transform: translateY(-100%); opacity: 0; }
}


/* ================================================================
   2. CENTER POPUP
   ================================================================ */
.pg-notif-popup-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.35) 0%, rgba(3, 7, 18, 0.8) 100%) !important;
    backdrop-filter: blur(8px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(8px) saturate(140%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    animation: pgNotifFadeIn 0.4s ease forwards;
    padding: 20px;
}

.pg-notif-popup-overlay.pg-notif-hiding {
    animation: pgNotifFadeOut 0.3s ease forwards;
}

.pg-notif-popup {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 440px;
    width: 100%;
    padding: 32px;
    background: rgba(15, 22, 42, 0.45) !important;
    backdrop-filter: blur(30px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 24px;
    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.6),
        0 0 50px rgba(var(--_rgb), 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
    position: relative;
    overflow: hidden;
    transform: scale(0.9);
    opacity: 0;
    animation: pgNotifPopIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.1s;
}

/* Top gradient strip */
.pg-notif-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--_from), var(--_to));
}

.pg-notif-popup .pg-notif-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pg-notif-popup .pg-notif-popup-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pg-notif-popup .pg-notif-message {
    -webkit-line-clamp: 5;
    line-clamp: 5;
}

.pg-notif-popup .pg-notif-cta {
    margin-top: 4px;
    padding: 10px 22px;
    font-size: 0.85rem;
}

@keyframes pgNotifPopIn {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

@keyframes pgNotifFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pgNotifFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}


/* ================================================================
   3. BOTTOM-RIGHT TOAST
   ================================================================ */
.pg-notif-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    max-width: 380px;
    width: calc(100vw - 48px);
    padding: 20px 22px;
    background: rgba(15, 22, 42, 0.45) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 20px;
    box-shadow:
        0 16px 40px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(var(--_rgb), 0.1),
        inset 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
    transform: translateX(120%);
    animation: pgNotifSlideInRight 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.5s;
    opacity: 0;
}

.pg-notif-toast.pg-notif-hiding {
    animation: pgNotifSlideOutRight 0.4s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* Left accent - removed for cleaner visual styling */
.pg-notif-toast::before {
    display: none;
}

/* Auto-dismiss progress bar */
.pg-notif-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    overflow: hidden;
}

.pg-notif-toast-progress-bar {
    height: 100%;
    background: var(--_from);
    animation: pgNotifProgressShrink 10s linear forwards;
}

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

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

@keyframes pgNotifProgressShrink {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ── Layout Sizes (Small / Medium / Large) ── */

/* 1. Small Layout */
.pg-notif[data-size="small"] {
    --_notif-padding: 8px 16px;
    --_notif-gap: 10px;
}
.pg-notif-banner[data-size="small"] {
    padding: 8px 16px;
    gap: 10px;
}
.pg-notif-toast[data-size="small"] {
    padding: 12px 14px;
    gap: 10px;
    border-radius: 14px;
}
.pg-notif[data-size="small"] .pg-notif-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 6px;
    font-size: 16px;
}
.pg-notif[data-size="small"] .pg-notif-icon .material-icons-round {
    font-size: 16px;
}
.pg-notif[data-size="small"] .pg-notif-thumb {
    height: 32px;
    width: auto;
    max-width: 80px;
    border-radius: 6px;
}
.pg-notif[data-size="small"] .pg-notif-title {
    font-size: 0.85rem;
}
.pg-notif[data-size="small"] .pg-notif-message {
    font-size: 0.78rem;
}
.pg-notif[data-size="small"] .pg-notif-cta {
    padding: 5px 12px;
    font-size: 0.75rem;
    margin-top: 6px;
}
.pg-notif[data-size="small"] .pg-notif-dismiss {
    width: 26px;
    height: 26px;
    min-width: 26px;
}
.pg-notif[data-size="small"] .pg-notif-dismiss .material-icons-round {
    font-size: 14px;
}

/* 2. Large Layout */
.pg-notif-banner[data-size="large"] {
    padding: 16px 32px;
    gap: 18px;
}
.pg-notif-toast[data-size="large"] {
    padding: 24px;
    gap: 18px;
    border-radius: 22px;
}
.pg-notif[data-size="large"] .pg-notif-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    font-size: 24px;
}
.pg-notif[data-size="large"] .pg-notif-icon .material-icons-round {
    font-size: 24px;
}
.pg-notif[data-size="large"] .pg-notif-thumb {
    height: 50px;
    width: auto;
    max-width: 120px;
    border-radius: 12px;
}
.pg-notif[data-size="large"] .pg-notif-title {
    font-size: 1.05rem;
}
.pg-notif[data-size="large"] .pg-notif-message {
    font-size: 0.92rem;
}
.pg-notif[data-size="large"] .pg-notif-cta {
    padding: 9px 20px;
    font-size: 0.85rem;
    margin-top: 10px;
}
.pg-notif[data-size="large"] .pg-notif-dismiss {
    width: 36px;
    height: 36px;
    min-width: 36px;
}
.pg-notif[data-size="large"] .pg-notif-dismiss .material-icons-round {
    font-size: 20px;
}

/* Popup-specific sizes */
.pg-notif-popup[data-size="small"] {
    padding: 20px;
    gap: 12px;
    max-width: 380px;
}
.pg-notif-popup[data-size="small"] .pg-notif-title { font-size: 0.9rem; }
.pg-notif-popup[data-size="small"] .pg-notif-message { font-size: 0.8rem; }
.pg-notif-popup[data-size="small"] .pg-notif-cta { padding: 8px 16px; font-size: 0.8rem; }

.pg-notif-popup[data-size="large"] {
    padding: 36px;
    gap: 20px;
    max-width: 500px;
}
.pg-notif-popup[data-size="large"] .pg-notif-title { font-size: 1.15rem; }
.pg-notif-popup[data-size="large"] .pg-notif-message { font-size: 0.95rem; }
.pg-notif-popup[data-size="large"] .pg-notif-cta { padding: 12px 26px; font-size: 0.9rem; }

/* 3. Original Layout (Unconstrained / Full Size) */
.pg-notif-banner[data-size="original"] {
    padding: 20px 36px;
    gap: 20px;
}
.pg-notif-toast[data-size="original"] {
    padding: 24px 28px;
    gap: 20px;
    max-width: 440px;
    border-radius: 24px;
}
.pg-notif[data-size="original"] .pg-notif-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    font-size: 28px;
}
.pg-notif[data-size="original"] .pg-notif-icon .material-icons-round {
    font-size: 28px;
}
.pg-notif[data-size="original"] .pg-notif-thumb {
    height: 56px;
    width: auto;
    max-width: 140px;
    border-radius: 14px;
}
.pg-notif[data-size="original"] .pg-notif-title {
    font-size: 1.1rem;
}
.pg-notif[data-size="original"] .pg-notif-message {
    font-size: 0.95rem;
    -webkit-line-clamp: 4;
    line-clamp: 4;
}
.pg-notif[data-size="original"] .pg-notif-cta {
    padding: 10px 24px;
    font-size: 0.88rem;
    margin-top: 12px;
}
.pg-notif[data-size="original"] .pg-notif-dismiss {
    width: 38px;
    height: 38px;
    min-width: 38px;
}
.pg-notif[data-size="original"] .pg-notif-dismiss .material-icons-round {
    font-size: 22px;
}

.pg-notif-popup[data-size="original"] {
    padding: 40px;
    gap: 24px;
    max-width: 600px;
}
.pg-notif-popup[data-size="original"] .pg-notif-title { font-size: 1.25rem; }
.pg-notif-popup[data-size="original"] .pg-notif-message { font-size: 1rem; }
.pg-notif-popup[data-size="original"] .pg-notif-cta { padding: 12px 28px; font-size: 0.92rem; }
.pg-notif-popup[data-size="original"] .pg-notif-image-popup { max-height: 300px; }


/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 640px) {
    .pg-notif-banner {
        padding: 10px 14px;
        gap: 10px;
        align-items: flex-start;
    }

    .pg-notif-banner .pg-notif-body {
        padding-top: 1px;
    }

    .pg-notif-banner .pg-notif-title {
        font-size: 0.85rem;
    }

    .pg-notif-banner .pg-notif-message {
        font-size: 0.78rem;
        -webkit-line-clamp: 2; /* 2 lines is better for readability */
        line-clamp: 2;
    }

    .pg-notif-banner .pg-notif-dismiss {
        align-self: flex-start;
    }

    .pg-notif-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        border-radius: 8px;
    }

    .pg-notif-icon .material-icons-round {
        font-size: 16px;
    }

    .pg-notif-thumb {
        height: 36px;
        width: auto;
        max-width: 80px;
        border-radius: 8px;
    }

    .pg-notif-toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
        padding: 14px 16px;
        align-items: flex-start;
    }

    .pg-notif-toast .pg-notif-dismiss {
        align-self: flex-start;
    }

    .pg-notif-popup-overlay {
        padding: 16px;
    }

    .pg-notif-popup {
        padding: 20px;
        border-radius: 20px;
        gap: 14px;
    }

    .pg-notif-image-popup {
        max-height: 140px;
    }

    .pg-notif-cta {
        font-size: 0.78rem;
        padding: 7px 16px;
    }

    .pg-notif-dismiss {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }

    .pg-notif-dismiss .material-icons-round {
        font-size: 16px;
    }
}

/* Extra adjustments for small Android devices (< 400px) */
@media (max-width: 400px) {
    .pg-notif-banner {
        padding: 8px 10px;
        gap: 8px;
    }

    .pg-notif-banner .pg-notif-title {
        font-size: 0.82rem;
    }

    .pg-notif-banner .pg-notif-message {
        font-size: 0.75rem;
    }

    .pg-notif-icon {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }

    .pg-notif-thumb {
        height: 30px;
        width: auto;
        max-width: 70px;
    }

    .pg-notif-popup-overlay {
        padding: 10px;
    }

    .pg-notif-popup {
        padding: 16px;
        border-radius: 16px;
        gap: 12px;
    }

    .pg-notif-image-popup {
        max-height: 110px;
    }

    .pg-notif-toast {
        bottom: 12px;
        right: 12px;
        left: 12px;
        padding: 12px;
    }
}
