/* ===== NAVBAR SECURITY COMPONENT ===== */

/* --- Shield Icon in Navbar --- */
.nav-security-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #2563eb;
    font-size: 18px;
    background: transparent;
    border: none;
    flex-shrink: 0;
}
.nav-security-btn:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
}
.nav-security-btn:active {
    transform: scale(0.94);
}

/* Alert state - amber glow */
.nav-security-btn.has-alert {
    color: #f59e0b;
}
.nav-security-btn.has-alert:hover {
    color: #d97706;
    background: rgba(245, 158, 11, 0.08);
}

/* Badge - red count dot (like notification bell) */
.security-alert-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.45);
    pointer-events: none;
}

/* ===== OVERLAY ===== */
.security-overlay {
    position: fixed; inset: 0; z-index: 998;
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0; visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}
.security-overlay.open {
    opacity: 1; visibility: visible;
}

/* ===== POPUP PANEL ===== */
.security-popup {
    position: fixed;
    top: 68px;
    right: 20px;
    width: 440px;
    max-height: calc(100vh - 100px);
    z-index: 999;
    background: rgba(255, 255, 255, 0.975);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 20px;
    box-shadow:
        0 24px 56px rgba(15, 23, 42, 0.14),
        0 4px 16px rgba(15, 23, 42, 0.06),
        0 0 0 0.5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    opacity: 0; visibility: hidden;
    transform: translateY(-10px) scale(0.96);
    transform-origin: top right;
    transition:
        opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
.security-popup.open {
    opacity: 1; visibility: visible;
    transform: translateY(0) scale(1);
}

/* ===== HEADER ===== */
.security-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.security-popup-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}
.security-popup-title i {
    color: #f59e0b;
    font-size: 18px;
}
.security-popup-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(203,213,225,0.4);
    background: rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #94a3b8; font-size: 14px;
    transition: all 0.2s ease;
}
.security-popup-close:hover {
    background: rgba(239,68,68,0.08); color: #ef4444;
    border-color: rgba(239,68,68,0.2);
}

/* ===== BODY ===== */
.security-popup-body {
    flex: 1; overflow-y: auto; overscroll-behavior: contain;
    padding: 20px 24px;
}
.security-popup-body::-webkit-scrollbar { width: 4px; }
.security-popup-body::-webkit-scrollbar-track { background: transparent; }
.security-popup-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }
.security-popup-body::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* Section title */
.security-section-title {
    font-size: 12px; font-weight: 600; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-bottom: 10px;
}

/* Security item */
.security-check-item {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(226,232,240,0.5);
    margin-bottom: 8px;
    transition: all 0.2s ease;
}
.security-check-item:hover { border-color: rgba(37,99,235,0.15); }
.security-check-item.warning {
    background: linear-gradient(135deg, rgba(245,158,11,0.05), rgba(245,158,11,0.02));
    border-color: rgba(245,158,11,0.2);
}
.security-check-item.danger {
    background: rgba(239,68,68,0.04);
    border-color: rgba(239,68,68,0.15);
}

.security-check-icon {
    width: 42px; height: 42px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; flex-shrink: 0;
}
.security-check-icon.safe { background: rgba(16,185,129,0.1); color: #059669; }
.security-check-icon.warn { background: rgba(245,158,11,0.1); color: #d97706; }
.security-check-icon.danger { background: rgba(239,68,68,0.1); color: #dc2626; }

.security-check-info { flex: 1; min-width: 0; }
.security-check-info h4 { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 2px; }
.security-check-info p { font-size: 12px; color: #94a3b8; line-height: 1.5; }

.security-status-tag {
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.security-status-tag.safe { color: #059669; }
.security-status-tag.warn { color: #d97706; }

.security-footer-note {
    margin-top: 16px; padding: 12px 16px;
    border-radius: 12px;
    background: rgba(37,99,235,0.04);
    font-size: 13px; color: #64748b;
    display: flex; align-items: flex-start; gap: 8px;
    line-height: 1.5;
}
.security-footer-note i { color: #2563eb; margin-top: 1px; flex-shrink: 0; }

/* ===== PHONE BIND FORM (in popup) ===== */
.sec-bind-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(226,232,240,0.6);
}
.sec-bind-row {
    display: flex; gap: 8px; align-items: center;
    margin-bottom: 8px;
}
.sec-input-wrap {
    flex: 1;
    position: relative;
    display: flex; align-items: center;
}
.sec-input-wrap i {
    position: absolute;
    left: 12px;
    font-size: 14px;
    color: #94a3b8;
    pointer-events: none;
    z-index: 1;
}
.sec-input-wrap input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 13px; color: #334155;
    font-family: inherit; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.sec-input-wrap input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}
.sec-sms-btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
}
.sec-sms-btn:hover { background: #f8fafc; color: #334155; }
.sec-sms-btn:disabled { opacity: 0.5; cursor: not-allowed; background: #f1f5f9; }
.sec-bind-btn {
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
}
.sec-bind-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.sec-bind-btn:active { transform: scale(0.97); }
.sec-bind-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.sec-bind-msg {
    font-size: 12px; font-weight: 500; min-height: 16px;
}
.sec-bind-msg.success { color: #059669; }
.sec-bind-msg.error { color: #dc2626; }
.sec-bind-msg.info { color: #64748b; }

/* All-safe hero */
.security-all-safe {
    text-align: center;
    padding: 28px 20px;
    margin-bottom: 8px;
}
.security-safe-icon-wrap {
    width: 56px; height: 56px; border-radius: 18px;
    background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(16,185,129,0.04));
    border: 1px solid rgba(16,185,129,0.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: #059669;
    margin: 0 auto 12px;
}
.security-all-safe h4 {
    font-size: 16px; font-weight: 700; color: #1e293b; margin-bottom: 4px;
}
.security-all-safe p {
    font-size: 13px; color: #94a3b8; line-height: 1.5; max-width: 300px; margin: 0 auto;
}

/* Section subtitle */
.security-section-subtitle {
    font-size: 13px; color: #94a3b8;
    margin-bottom: 12px; line-height: 1.4;
}

/* Empty */
.security-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 48px 28px; text-align: center;
}
.security-empty-icon {
    width: 68px; height: 68px; border-radius: 20px;
    background: #f8fafc; border: 1px solid #f1f5f9;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: #cbd5e1; margin-bottom: 14px;
}
.security-empty h4 { font-size: 15px; font-weight: 600; color: #64748b; margin-bottom: 6px; }
.security-empty p { font-size: 13px; color: #94a3b8; line-height: 1.5; max-width: 260px; }

/* ===== TOAST ===== */
.sec-toast {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9999;
    padding: 14px 22px;
    border-radius: 12px;
    font-size: 14px; font-weight: 600;
    color: #fff;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    animation: secToastIn 0.3s ease;
    max-width: 380px;
    line-height: 1.5;
}
.sec-toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.sec-toast.error { background: linear-gradient(135deg, #dc2626, #ef4444); }
.sec-toast.info { background: linear-gradient(135deg, #2563eb, #3b82f6); }

@keyframes secToastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
    .security-popup {
        width: calc(100vw - 24px); right: 12px; top: 62px;
        border-radius: 16px;
    }
}
