/* =====================================================================
   War Room – Auth Modal  (assets/css/auth-modal.css)
   ===================================================================== */

/* ── Overlay ────────────────────────────────────────────────────────── */
.wr-auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 16px;
    backdrop-filter: blur(4px);
}

/* ── Box ────────────────────────────────────────────────────────────── */
.wr-auth-box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px 28px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Close button ───────────────────────────────────────────────────── */
.wr-auth-box .wr-auth-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background .15s, color .15s;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    width: auto;
    min-width: 0;
}
.wr-auth-box .wr-auth-close:hover { background: #f0f0f0; color: #333; }

/* ── Tabs ────────────────────────────────────────────────────────────── */
.wr-auth-box .wr-auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #e5e7eb;
}
.wr-auth-box .wr-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: #9ca3af;
    cursor: pointer;
    position: relative;
    transition: color .2s;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    border-radius: 0;
    width: auto;
    min-width: 0;
    line-height: normal;
    text-align: center;
}
.wr-auth-box .wr-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #6366f1;
    transform: scaleX(0);
    transition: transform .2s;
}
.wr-auth-box .wr-tab.active { color: #6366f1; }
.wr-auth-box .wr-tab.active::after { transform: scaleX(1); }

/* ── Sub-tabs ────────────────────────────────────────────────────────── */
.wr-auth-box .wr-sub-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}
.wr-auth-box .wr-sub-tab {
    flex: 1;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: background .2s, color .2s;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    line-height: normal;
    text-align: center;
    min-width: 0;
    width: auto;
}
.wr-auth-box .wr-sub-tab.active {
    background: #eef2ff;
    color: #6366f1;
}

/* ── Panels ──────────────────────────────────────────────────────────── */
.wr-auth-box .wr-panel  { display: none; }
.wr-auth-box .wr-panel.active { display: block; }
.wr-auth-box .wr-sub-panel { display: none; }
.wr-auth-box .wr-sub-panel.active { display: block; }

/* ── Field group ─────────────────────────────────────────────────────── */
.wr-auth-box .wr-field-group {
    margin-bottom: 14px;
}
.wr-auth-box .wr-field-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
}

/* ── Input ───────────────────────────────────────────────────────────── */
.wr-auth-box .wr-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    box-shadow: none;
    line-height: normal;
    font-family: inherit;
}
.wr-auth-box .wr-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.wr-auth-box .wr-otp-digits {
    letter-spacing: 6px;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
}

/* ── Phone row ───────────────────────────────────────────────────────── */
.wr-auth-box .wr-phone-row {
    display: flex;
    gap: 8px;
}
.wr-auth-box .wr-cc {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 130px;
    padding: 10px 6px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 12px;
    background: #f9fafb;
    outline: none;
    cursor: pointer;
    transition: border-color .2s;
    box-shadow: none;
    font-family: inherit;
    line-height: normal;
    color: #111827;
    box-sizing: border-box;
}
.wr-auth-box .wr-cc:focus { border-color: #6366f1; }
.wr-auth-box .wr-phone-row .wr-input { flex: 1; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.wr-auth-box .wr-btn-primary {
    display: block;
    width: 100%;
    padding: 11px 16px !important;
    background: #6366f1 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px;
    font-size: 14px !important;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background .2s, transform .1s;
    margin-top: 6px;
    box-shadow: none !important;
    text-transform: none;
    letter-spacing: normal;
    line-height: normal;
    font-family: inherit;
    text-decoration: none;
    box-sizing: border-box;
}
.wr-auth-box .wr-btn-primary:hover { background: #4f46e5 !important; color: #fff !important; }
.wr-auth-box .wr-btn-primary:active { transform: scale(.98); }
.wr-auth-box .wr-btn-primary:disabled { background: #a5b4fc !important; cursor: not-allowed; }

.wr-auth-box .wr-btn-outline {
    display: block;
    width: 100%;
    padding: 10px 16px !important;
    background: #fff !important;
    color: #6366f1 !important;
    border: 1.5px solid #6366f1 !important;
    border-radius: 8px;
    font-size: 14px !important;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background .2s;
    margin-top: 4px;
    box-shadow: none !important;
    text-transform: none;
    letter-spacing: normal;
    line-height: normal;
    font-family: inherit;
    text-decoration: none;
    box-sizing: border-box;
}
.wr-auth-box .wr-btn-outline:hover { background: #eef2ff !important; color: #6366f1 !important; }

.wr-auth-box .wr-btn-link {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    line-height: normal;
    font-family: inherit;
    width: auto;
    min-width: 0;
}

/* ── OTP row (hidden until OTP sent) ────────────────────────────────── */
.wr-auth-box .wr-otp-row { margin-top: 14px; }

/* ── Resend line ─────────────────────────────────────────────────────── */
.wr-auth-box .wr-resend {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 10px;
}

/* ── Message / error ─────────────────────────────────────────────────── */
.wr-auth-box .wr-msg {
    margin-top: 10px;
    font-size: 13px;
    min-height: 18px;
    color: #dc2626;
    text-align: center;
}
.wr-auth-box .wr-msg.success { color: #16a34a; }

/* ── Step indicator ──────────────────────────────────────────────────── */
.wr-auth-box .wr-step-indicator {
    font-size: 12px;
    color: #9ca3af;
    text-align: right;
    margin: 0 0 4px;
}
.wr-auth-box .wr-step-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px;
}
.wr-auth-box .wr-step-sub {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 16px;
}

/* ── Profile buttons ─────────────────────────────────────────────────── */
.wr-auth-box .wr-profile-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.wr-auth-box .wr-profile-btns .wr-btn-link {
    text-align: center;
    margin-top: 4px;
    display: block;
}

/* ── Login button shortcode widget ──────────────────────────────────── */
#wr-open-auth-modal,
.wr-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    text-decoration: none;
}
#wr-open-auth-modal:hover,
.wr-login-btn:hover { background: #4f46e5; }

/* ── User widget (logged in state) ───────────────────────────────────── */
.wr-user-widget {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.wr-user-display-name {
    color: #374151;
    font-weight: 500;
}
/* 3-dot button */
.wr-user-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    overflow: visible !important; /* prevent theme clipping the dropdown */
}
.wr-user-dots {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #6b7280;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}
.wr-user-dots:hover { background: #f3f4f6; color: #111827; }
/* Dropdown */
.wr-user-dropdown {
    /* Hidden by default — display:none !important beats GP's .main-navigation ul ul { display:block } */
    display: none !important;
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
    top: calc(100% + 4px) !important;
    min-width: 140px;
    background: #fff !important;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 4px 0 !important;
    z-index: 99999 !important;
    float: none !important;
    transition: none !important;
    width: auto !important;
    text-align: left !important;
}
.wr-user-dropdown.wr-open {
    display: block !important;
    /* Restore visibility overrides here so they're only active when shown */
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
    pointer-events: auto !important;
}
/* On mobile the nav container clips position:absolute and applies visibility:hidden to ul ul —
   GP rule: .main-navigation.toggled .main-nav ul ul { visibility:hidden }
   Switch to relative layout and restore visibility. */
@media (max-width: 1050px) {
    .wr-user-menu-wrap {
        display: block !important;
        width: 100% !important;
    }
    .wr-user-dropdown.wr-open {
        position: relative !important;
        right: auto !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        margin-top: 4px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
        visibility: visible !important;
    }
}
.wr-user-dropdown li { margin: 0 !important; padding: 0 !important; width: auto !important; }
.wr-user-dropdown li a {
    display: block !important;
    padding: 9px 16px !important;
    font-size: 14px !important;
    color: #374151 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transition: background 0.12s !important;
    line-height: normal !important; /* override GP: line-height reset for sub-menu */
}
.wr-user-dropdown li a:hover { background: #f3f4f6 !important; color: #111827 !important; }
.wr-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
    pointer-events: none;
}
.wr-logout-link { background: transparent !important; }
.wr-logout-link:hover { background: #fff5f5 !important; color: #ef4444 !important; }

@media (prefers-color-scheme: dark) {
    .wr-user-dropdown {
        background: #1f2937 !important;
        border-color: #374151 !important;
        box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
    }
    .wr-user-dropdown li a {
        color: #d1d5db !important;
    }
    .wr-user-dropdown li a:hover {
        background: #374151 !important;
        color: #f9fafb !important;
    }
    .wr-dropdown-divider {
        background: #374151;
    }
    .wr-logout-link:hover { background: #450a0a !important; color: #fca5a5 !important; }
    .wr-user-dots { color: #9ca3af; }
    .wr-user-dots:hover { background: #374151 !important; color: #f9fafb !important; }
    .wr-user-display-name { color: #d1d5db; }
}

/* ── Nav-menu integration ─────────────────────────────────────────────
   When the login widget lives inside a <li class="wr-menu-login-item">
   in a WordPress nav menu, reset list / inline styles that themes apply.
   ─────────────────────────────────────────────────────────────────────── */
li.wr-menu-login-item {
    display: flex;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: visible !important; /* prevent GP nav overflow:hidden clipping dropdown */
    position: static !important;
}
li.wr-menu-login-item > .wr-login-btn,
li.wr-menu-login-item > #wr-open-auth-modal {
    white-space: nowrap;
}
li.wr-menu-login-item > .wr-user-widget {
    gap: 8px;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .wr-auth-box { padding: 24px 18px 20px; }
    .wr-auth-box .wr-auth-tabs { margin-bottom: 16px; }
    .wr-auth-box .wr-cc { max-width: 110px; font-size: 11px; }
}

/* ── Switch-mode link (e.g. "或 用驗證碼登入") ──────────────────────── */
.wr-auth-box .wr-switch-mode {
    margin: 10px 0 0;
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
}
.wr-auth-box .wr-switch-mode .wr-link {
    font-size: 13px;
    color: #6366f1;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    box-shadow: none;
    min-width: 0;
    width: auto;
    line-height: inherit;
    text-transform: none;
    letter-spacing: normal;
}
.wr-auth-box .wr-switch-mode .wr-link:hover { color: #4f46e5; }

/* ── Settings Overlay
   ===================================================================== */

/* Settings box uses the same .wr-auth-box base; these rules add specifics */
.wr-settings-box .wr-stab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #9ca3af;
    cursor: pointer;
    position: relative;
    transition: color .2s;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    border-radius: 0;
    width: auto;
    min-width: 0;
    line-height: normal;
    text-align: center;
}
.wr-settings-box .wr-stab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #6366f1;
    transform: scaleX(0);
    transition: transform .2s;
}
.wr-settings-box .wr-stab.active { color: #6366f1; }
.wr-settings-box .wr-stab.active::after { transform: scaleX(1); }

/* Contact sub-tabs inside settings */
.wr-settings-box .wr-ssub-tab {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1.5px solid #d1d5db;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    line-height: normal;
    min-width: 0;
    width: auto;
}
.wr-settings-box .wr-ssub-tab.active {
    background: #6366f1;
    color: #fff !important;
    border-color: #6366f1;
}
.wr-settings-box .wr-ssub-tab:hover:not(.active) {
    background: #f3f4f6;
}

/* Current contact display */
.wr-settings-box .wr-step-sub {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
    margin-top: 0;
}

/* Settings panel spacing */
.wr-settings-box .wr-spanel {
    padding-top: 4px;
}

/* =====================================================================
   Notifications Overlay
   ===================================================================== */

/* Badge pill on the 🔔 menu item */
.wr-notif-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}

/* Notification box uses .wr-auth-box base */
.wr-notif-box {
    max-width: 460px;
}

/* Loading / empty text */
.wr-notif-loading,
.wr-notif-empty {
    font-size: 14px;
    color: #6b7280;
    text-align: center;
    padding: 24px 0 8px;
    margin: 0;
}

/* Invite list */
.wr-notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.wr-notif-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0;
    border-bottom: 1px solid #e5e7eb;
}
.wr-notif-item:last-child { border-bottom: none; }

.wr-notif-content { flex: 1; min-width: 0; }
.wr-notif-from {
    font-size: 14px;
    color: #111827;
    margin: 0 0 4px;
}
.wr-notif-desc {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wr-notif-actions {
    display: flex;
    gap: 8px;
}
.wr-notif-actions .wr-btn-primary,
.wr-notif-actions .wr-btn-outline {
    padding: 6px 16px !important;
    font-size: 13px !important;
    min-width: 0;
    width: auto;
}

@media (min-width: 420px) {
    .wr-notif-item {
        flex-direction: row;
        align-items: center;
    }
    .wr-notif-actions { flex-shrink: 0; }
}

/* Required field marker */
.wr-required {
    color: #ef4444;
    margin-left: 2px;
}

/* Small hint text below a field */
.wr-field-hint {
    font-size: 11px;
    color: #9ca3af;
    margin: 4px 0 0;
}
