/**
 * Panic Warning Alert — Client Area Styles
 * Compatible with: Six Theme, Lagom Theme, Custom WHMCS Templates
 * Version: 1.0.0
 */

/* ══════════════════════════════════════════════════
   VARIABLES & RESET
══════════════════════════════════════════════════ */
.pwa-banner,
.pwa-popup-overlay {
    --pwa-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --pwa-white: #ffffff;
    --pwa-black: #000000;
    --pwa-radius: 0px;
    box-sizing: border-box;
}

.pwa-banner *,
.pwa-popup-overlay * {
    box-sizing: border-box;
    font-family: var(--pwa-font);
}

/* ══════════════════════════════════════════════════
   MAIN BANNER — STICKY TOP BAR
══════════════════════════════════════════════════ */
#pwa-main-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    background: var(--pwa-bg, #f59e0b);
    color: #fff;
    min-height: 56px;
    display: flex;
    align-items: center;
    padding: 10px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    animation: pwaSlideDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    transform-origin: top center;
    will-change: transform;
}

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

/* Push page content down */
body.pwa-banner-active {
    padding-top: 56px !important;
    transition: padding-top 0.4s ease;
}

/* ── Inner layout ── */
.pwa-banner-inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    gap: 16px;
    flex-wrap: wrap;
}

.pwa-banner-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pwa-banner-center {
    flex: 1;
    min-width: 0;
}

.pwa-banner-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ── Pulse dot ── */
.pwa-pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
    animation: pwaPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5);
}

@keyframes pwaPulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.6); }
    70%  { box-shadow: 0 0 0 10px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

/* ── Label ── */
.pwa-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(0, 0, 0, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    color: #fff;
}

/* ── Domain ── */
.pwa-domain {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    color: #fff;
}

/* ── Message ── */
.pwa-message {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
}

/* ── Multi-alert badge ── */
.pwa-multi-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.25);
    color: rgba(255, 255, 255, 0.9);
    padding: 2px 7px;
    border-radius: 100px;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Buttons ── */
.pwa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
    border: none;
    outline: none;
}

.pwa-btn:hover { transform: translateY(-1px); opacity: 0.92; text-decoration: none; }
.pwa-btn:active { transform: translateY(0); }

.pwa-btn-renew {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
}

.pwa-btn-invoice {
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.pwa-btn-whatsapp {
    background: #25D366;
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.4);
}

/* ── Close button ── */
.pwa-close {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.8);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    padding: 0;
}

.pwa-close:hover { background: rgba(0, 0, 0, 0.4); color: #fff; }

/* ══════════════════════════════════════════════════
   BANNER TYPE MODIFIERS
══════════════════════════════════════════════════ */

/* Critical / Terminated — animated gradient */
.pwa-type-critical,
.pwa-type-terminated {
    background-image: linear-gradient(90deg,
        var(--pwa-bg, #ef4444) 0%,
        rgba(0,0,0,0.15) 50%,
        var(--pwa-bg, #ef4444) 100%) !important;
    background-size: 200% 100%;
    animation: pwaSlideDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both,
               pwaBgShift 3s ease infinite;
}

@keyframes pwaBgShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Terminated — extra dark */
.pwa-type-terminated {
    --pwa-bg: #1a1a2e;
    border-bottom: 3px solid #ef4444;
}

/* ══════════════════════════════════════════════════
   COUNTDOWN TIMER
══════════════════════════════════════════════════ */
.pwa-countdown {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 5px 10px;
}

.pwa-cd-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 36px;
}

.pwa-cd-num {
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    font-variant-numeric: tabular-nums;
    transition: transform 0.2s;
}

.pwa-cd-num.pwa-flip {
    animation: pwaFlip 0.3s ease;
}

@keyframes pwaFlip {
    0%   { transform: scaleY(0.3); opacity: 0.5; }
    50%  { transform: scaleY(1.1); }
    100% { transform: scaleY(1); opacity: 1; }
}

.pwa-cd-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 1px;
}

.pwa-cd-sep {
    font-size: 18px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

/* ══════════════════════════════════════════════════
   POPUP / MODAL
══════════════════════════════════════════════════ */
.pwa-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: pwaFadeIn 0.3s ease both;
}

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

.pwa-popup-overlay.pwa-hidden { display: none; }

.pwa-popup-box {
    background: #fff;
    border-radius: 16px;
    max-width: 460px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    animation: pwaPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes pwaPopIn {
    from { transform: scale(0.85) translateY(20px); opacity: 0; }
    to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

/* Popup header */
.pwa-popup-header {
    padding: 32px 28px 20px;
    text-align: center;
    position: relative;
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
}

.pwa-popup-type-critical .pwa-popup-header,
.pwa-popup-type-terminated .pwa-popup-header {
    background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
}

.pwa-popup-type-suspension .pwa-popup-header {
    background: linear-gradient(135deg, #fff7ed 0%, #fff 100%);
}

.pwa-popup-type-warning .pwa-popup-header {
    background: linear-gradient(135deg, #fffbeb 0%, #fff 100%);
}

/* Icon ring */
.pwa-popup-icon-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    animation: pwaRingPulse 2s ease-in-out infinite;
}

@keyframes pwaRingPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
    50%       { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
}

.pwa-popup-icon-inner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444, #f97316);
    position: relative;
}

.pwa-popup-icon-inner::after {
    content: '🚨';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.pwa-popup-title {
    font-size: 20px;
    font-weight: 800;
    color: #1a1a2e;
    margin: 0;
}

/* Popup body */
.pwa-popup-body {
    padding: 20px 28px;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.pwa-popup-service,
.pwa-popup-date {
    font-size: 14px;
    color: #475569;
    margin-bottom: 8px;
}

.pwa-popup-service strong,
.pwa-popup-date strong {
    color: #1e293b;
}

.pwa-popup-message {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    margin-top: 12px;
}

/* Popup footer */
.pwa-popup-footer {
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pwa-popup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.pwa-popup-btn:hover { transform: translateY(-1px); text-decoration: none; }

.pwa-popup-renew {
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    box-shadow: 0 4px 14px rgba(239,68,68,0.35);
}

.pwa-popup-wa {
    background: #25D366;
    color: #fff;
    box-shadow: 0 4px 14px rgba(37,211,102,0.3);
}

.pwa-popup-dismiss {
    background: #f1f5f9;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

.pwa-popup-dismiss:hover { background: #e2e8f0; color: #475569; }

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    #pwa-main-banner {
        min-height: auto;
        padding: 10px 14px 10px 14px;
    }

    .pwa-banner-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .pwa-banner-right {
        width: 100%;
    }

    .pwa-btn {
        flex: 1;
        justify-content: center;
        font-size: 11px;
        padding: 8px 10px;
    }

    .pwa-domain { max-width: 120px; }

    .pwa-countdown {
        flex-wrap: wrap;
        gap: 4px;
    }

    .pwa-cd-num { font-size: 15px; }

    .pwa-popup-box { max-width: 100%; border-radius: 12px; }
    .pwa-popup-header { padding: 24px 20px 16px; }
    .pwa-popup-body { padding: 16px 20px; }
    .pwa-popup-footer { padding: 16px 20px; }
    .pwa-popup-title { font-size: 17px; }

    body.pwa-banner-active { padding-top: 80px !important; }
}

@media (max-width: 480px) {
    .pwa-banner-left { flex-wrap: wrap; gap: 6px; }
    .pwa-message { font-size: 12px; }
    .pwa-close { top: 10px; transform: none; }
}

/* ══════════════════════════════════════════════════
   THEME COMPATIBILITY OVERRIDES
══════════════════════════════════════════════════ */

/* Six Theme */
.six #pwa-main-banner,
#wrapper #pwa-main-banner {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
}

/* Lagom Theme */
.lagom-wrapper #pwa-main-banner,
.lagom #pwa-main-banner {
    position: fixed !important;
    top: 0 !important;
    width: 100% !important;
}

/* Override any theme that might hide overflow */
body { overflow-x: hidden; }
