/**
 * PIIRATE Elite — Smart Light Mode
 * Background-conscious, high-contrast, readable
 */

/* ═══ BASE BODY ═══ */
body.light-mode {
    background: #f1f5f9 !important;
    color: #1e293b !important;
}

/* ═══ NAVIGATION ═══ */
body.light-mode .navbar,
body.light-mode nav,
body.light-mode .main-nav {
    background: linear-gradient(135deg, #ffffff, #f8fafc) !important;
    border-bottom: 2px solid #e2e8f0 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08) !important;
}
body.light-mode .navbar a,
body.light-mode .nav-link,
body.light-mode nav a {
    color: #334155 !important;
}
body.light-mode .navbar a:hover,
body.light-mode .nav-link:hover {
    color: #dc2626 !important;
}
body.light-mode .navbar .brand-text,
body.light-mode .nav-brand span {
    color: #f59e0b !important;
}

/* ═══ HAMBURGER / MOBILE MENU ═══ */
body.light-mode .mobile-menu,
body.light-mode .nav-mobile-menu,
body.light-mode .hamburger-menu {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}
body.light-mode .mobile-menu a,
body.light-mode .nav-mobile-menu a {
    color: #334155 !important;
}

/* ═══ HERO / SECTIONS ═══ */
body.light-mode section,
body.light-mode .section {
    background: transparent !important;
}
body.light-mode .hero-section,
body.light-mode .free-scan-section-v2 {
    background: linear-gradient(165deg, #e0e7ff 0%, #dbeafe 25%, #e0f2fe 50%, #f0f9ff 75%, #f8fafc 100%) !important;
}

/* ═══ CARDS & CONTAINERS ═══ */
body.light-mode .card,
body.light-mode .service-card,
body.light-mode .feature-card,
body.light-mode .pricing-card,
body.light-mode .results-card,
body.light-mode .stat-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    color: #1e293b !important;
}

/* ═══ TEXT — Context-Aware Contrast ═══ */
body.light-mode h1, body.light-mode h2, body.light-mode h3,
body.light-mode h4, body.light-mode h5, body.light-mode h6 {
    color: #0f172a !important;
}
body.light-mode p,
body.light-mode span,
body.light-mode li,
body.light-mode label,
body.light-mode td,
body.light-mode th {
    color: #334155 !important;
}
body.light-mode a {
    color: #2563eb !important;
}
body.light-mode a:hover {
    color: #dc2626 !important;
}
body.light-mode .text-muted,
body.light-mode small,
body.light-mode .text-secondary {
    color: #64748b !important;
}

/* ═══ BUTTONS — Keep branded colors ═══ */
body.light-mode .btn-primary,
body.light-mode .cta-button,
body.light-mode .mobile-cta-btn {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    color: #ffffff !important;
    border: none !important;
}
body.light-mode .btn-outline-light {
    border-color: #334155 !important;
    color: #334155 !important;
}

/* ═══ FORMS & INPUTS ═══ */
body.light-mode input,
body.light-mode textarea,
body.light-mode select {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 2px solid #cbd5e1 !important;
}
body.light-mode input::placeholder,
body.light-mode textarea::placeholder {
    color: #94a3b8 !important;
}
body.light-mode input:focus,
body.light-mode textarea:focus,
body.light-mode select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15) !important;
}

/* ═══ FOOTER ═══ */
body.light-mode .main-footer {
    background: linear-gradient(135deg, #1e293b, #0f172a) !important;
    color: #cbd5e1 !important;
}
body.light-mode .main-footer a { color: #94a3b8 !important; }
body.light-mode .main-footer h6 { color: #e2e8f0 !important; }
body.light-mode .main-footer p { color: #94a3b8 !important; }

/* ═══ BADGES & ALERTS ═══ */
body.light-mode .badge {
    border: 1px solid rgba(0,0,0,0.1) !important;
}
body.light-mode .alert {
    border: 1px solid #e2e8f0 !important;
}

/* ═══ TABLES ═══ */
body.light-mode table {
    background: #ffffff !important;
}
body.light-mode th {
    background: #f8fafc !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}
body.light-mode td {
    border-color: #f1f5f9 !important;
}
body.light-mode tr:hover td {
    background: #f8fafc !important;
}

/* ═══ MODALS & OVERLAYS ═══ */
body.light-mode .modal-content,
body.light-mode .popup-content,
body.light-mode .checkout-content {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
}

/* ═══ COOKIE CONSENT ═══ */
body.light-mode .cookie-consent {
    background: linear-gradient(135deg, #1e293b, #0f172a) !important;
    color: #e2e8f0 !important;
}

/* ═══ SERVICE-SPECIFIC — Smart Contrast ═══ */
body.light-mode .service-card .price,
body.light-mode .pricing-amount {
    color: #dc2626 !important;
}
body.light-mode .service-card .features li {
    color: #475569 !important;
}
body.light-mode .service-card .features li i {
    color: #10b981 !important;
}
body.light-mode .trial-badge {
    background: rgba(16,185,129,0.1) !important;
    color: #059669 !important;
    border-color: rgba(16,185,129,0.3) !important;
}

/* ═══ SCAN SECTIONS ═══ */
body.light-mode .scan-result,
body.light-mode .results-container {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

/* ═══ STATUS BADGES ═══ */
body.light-mode .severity-critical { background: #fef2f2 !important; border-color: #fecaca !important; color: #991b1b !important; }
body.light-mode .severity-high { background: #fff7ed !important; border-color: #fed7aa !important; color: #9a3412 !important; }
body.light-mode .severity-medium { background: #fefce8 !important; border-color: #fef08a !important; color: #854d0e !important; }
body.light-mode .severity-low { background: #f0fdf4 !important; border-color: #bbf7d0 !important; color: #166534 !important; }

/* ═══ THEME TOGGLE BUTTON ═══ */
body.light-mode .piirate-theme-toggle,
body.light-mode .navbar-theme-btn {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0) !important;
    color: #f59e0b !important;
    border-color: #dc2626 !important;
}
body.light-mode .mobile-theme-btn {
    background: rgba(220,38,38,0.1) !important;
    color: #334155 !important;
}
body.light-mode .mobile-theme-btn .theme-icon-dark { display: none; }
body.light-mode .mobile-theme-btn .theme-icon-light { display: inline; }

/* ═══ ACCESSIBILITY PANEL ═══ */
body.light-mode .piirate-a11y-panel {
    background: linear-gradient(135deg, #ffffff, #f1f5f9) !important;
    border-color: rgba(220,38,38,0.2) !important;
}
body.light-mode .a11y-option { border-bottom-color: rgba(0,0,0,0.1) !important; }
body.light-mode .a11y-option label { color: #334155 !important; }
body.light-mode .a11y-panel-footer { background: #f1f5f9 !important; }

/* ═══ SCROLLBAR ═══ */
body.light-mode ::-webkit-scrollbar-track { background: #f1f5f9; }
body.light-mode ::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }
body.light-mode ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ═══ DARK INLINE STYLES OVERRIDE ═══ */
/* These catch inline style="color: #94a3b8" etc. on dark backgrounds */
body.light-mode [style*="color: #94a3b8"],
body.light-mode [style*="color:#94a3b8"],
body.light-mode [style*="color: #cbd5e1"],
body.light-mode [style*="color:#cbd5e1"],
body.light-mode [style*="color: #e2e8f0"],
body.light-mode [style*="color:#e2e8f0"] {
    color: #475569 !important;
}
body.light-mode [style*="color: #f1f5f9"],
body.light-mode [style*="color:#f1f5f9"],
body.light-mode [style*="color: #f8fafc"],
body.light-mode [style*="color:#f8fafc"],
body.light-mode [style*="color: white"],
body.light-mode [style*="color: #fff"],
body.light-mode [style*="color:#fff"] {
    color: #1e293b !important;
}
/* But NOT in footer or dark sections */
body.light-mode .main-footer [style*="color:"],
body.light-mode .cookie-consent [style*="color:"] {
    color: inherit !important;
}

/* ═══ DARK BACKGROUND OVERRIDES ═══ */
body.light-mode [style*="background: var(--dark"],
body.light-mode [style*="background:linear-gradient(135deg, #1e293b"],
body.light-mode [style*="background: linear-gradient(135deg, #1a1a2e"],
body.light-mode [style*="background: #0f172a"],
body.light-mode [style*="background:#0f172a"] {
    background: #ffffff !important;
}
/* Keep footer dark */
body.light-mode .main-footer,
body.light-mode .main-footer [style*="background"] {
    background: inherit !important;
}

/* ═══ NAVBAR THEME TOGGLE BUTTON ═══ */
.navbar-theme-btn {
    background: transparent;
    border: 2px solid rgba(220, 38, 38, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin-left: 10px;
    padding: 0;
}
.navbar-theme-btn:hover {
    border-color: #DC2626;
    background: rgba(220, 38, 38, 0.1);
    transform: scale(1.1);
}
.navbar-theme-btn .theme-icon-dark,
.navbar-theme-btn .theme-icon-light {
    position: absolute;
    font-size: 16px;
    transition: all 0.3s ease;
}
.navbar-theme-btn .theme-icon-dark {
    color: #f59e0b;
    opacity: 1;
}
.navbar-theme-btn .theme-icon-light {
    color: #f59e0b;
    opacity: 0;
}
body.light-mode .navbar-theme-btn .theme-icon-dark { opacity: 0; }
body.light-mode .navbar-theme-btn .theme-icon-light { opacity: 1; }
body.light-mode .navbar-theme-btn {
    border-color: #DC2626;
    background: rgba(220, 38, 38, 0.1);
}

/* ═══ MOBILE MENU THEME TOGGLE — Compact Design ═══ */
.mobile-theme-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px !important;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.mobile-theme-label {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.mobile-theme-btn-compact {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(220, 38, 38, 0.5);
    background: rgba(15, 23, 42, 0.6);
    color: #f59e0b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    padding: 0;
    font-size: 18px;
}
.mobile-theme-btn-compact:hover,
.mobile-theme-btn-compact:active {
    border-color: #DC2626;
    background: rgba(220, 38, 38, 0.15);
    transform: scale(1.1);
}
.mobile-theme-btn-compact .theme-icon-dark,
.mobile-theme-btn-compact .theme-icon-light {
    position: absolute;
    font-size: 18px;
    transition: opacity 0.3s ease;
}
.mobile-theme-btn-compact .theme-icon-dark { opacity: 1; }
.mobile-theme-btn-compact .theme-icon-light { opacity: 0; }
body.light-mode .mobile-theme-btn-compact .theme-icon-dark { opacity: 0; }
body.light-mode .mobile-theme-btn-compact .theme-icon-light { opacity: 1; }
body.light-mode .mobile-theme-btn-compact {
    background: rgba(241, 245, 249, 0.9);
    border-color: #DC2626;
}
body.light-mode .mobile-theme-label {
    color: #475569;
}

/* ═══ UNIVERSAL FORM INPUT FIX — Readable on ALL backgrounds ═══ */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="url"],
textarea,
select {
    background: rgba(30, 41, 59, 0.95) !important;
    color: #f1f5f9 !important;
    border: 2px solid rgba(59, 130, 246, 0.3) !important;
    caret-color: #f59e0b !important;
}
.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: rgba(148, 163, 184, 0.8) !important;
}
.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    background: rgba(30, 41, 59, 1) !important;
    color: #ffffff !important;
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15) !important;
}

/* Light mode inputs */
body.light-mode .form-control,
body.light-mode input[type="text"],
body.light-mode input[type="email"],
body.light-mode input[type="password"],
body.light-mode input[type="tel"],
body.light-mode input[type="number"],
body.light-mode input[type="search"],
body.light-mode input[type="url"],
body.light-mode textarea,
body.light-mode select {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 2px solid #cbd5e1 !important;
    caret-color: #3b82f6 !important;
}
body.light-mode .form-control::placeholder,
body.light-mode input::placeholder,
body.light-mode textarea::placeholder {
    color: #94a3b8 !important;
}
body.light-mode .form-control:focus,
body.light-mode input:focus,
body.light-mode textarea:focus,
body.light-mode select:focus {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

/* Labels */
label, .form-label {
    color: #e2e8f0 !important;
}
body.light-mode label,
body.light-mode .form-label {
    color: #334155 !important;
}

/* ═══ ADMIN NAV — App Links & Divider ═══ */
.admin-nav-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.15);
    margin: 0 4px;
    align-self: center;
}
.admin-nav-app-link {
    color: #94a3b8 !important;
    font-size: 0.75rem !important;
    opacity: 0.7;
    transition: all 0.2s ease;
}
.admin-nav-app-link:hover {
    color: #f59e0b !important;
    opacity: 1;
}
@media (max-width: 768px) {
    .admin-nav-divider {
        width: 100%;
        height: 1px;
        margin: 4px 0;
    }
}
