/* Shared site theme: dark (default) + light for base/login/market pages */

/* Site-wide UI scale: 75% resolution — height compensated to fill viewport */
:root {
    --ui-scale: 0.75;
}

html {
    zoom: var(--ui-scale);
    height: calc(100% / var(--ui-scale));
    min-height: calc(100dvh / var(--ui-scale));
}

@supports not (zoom: 1) {
    html {
        zoom: normal;
        transform: scale(0.75);
        transform-origin: 0 0;
        width: calc(100% / 0.75);
        height: calc(100% / 0.75);
        min-height: calc(100dvh / 0.75);
        overflow-x: hidden;
    }
}

html body {
    min-height: calc(100dvh / var(--ui-scale, 0.75));
}

:root {
    --theme-toggle-bg: rgba(255, 255, 255, 0.06);
    --theme-toggle-border: rgba(148, 163, 184, 0.28);
    --theme-toggle-color: #e2e8f0;
    --theme-toggle-hover: rgba(59, 130, 246, 0.18);
}

html[data-theme="light"] {
    --navy: #f3f6fb;
    --dark-navy: #ffffff;
    --blue: #2563eb;
    --green: #059669;
    --gold: #d97706;
    --light-text: #0b1220;
    --mid-text: #1e293b;
    --gray-text: #64748b;
    --theme-toggle-bg: #ffffff;
    --theme-toggle-border: rgba(15, 23, 42, 0.12);
    --theme-toggle-color: #0b1220;
    --theme-toggle-hover: rgba(37, 99, 235, 0.12);
}

.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--theme-toggle-border);
    background: var(--theme-toggle-bg);
    color: var(--theme-toggle-color);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, color 0.2s ease;
}

.theme-toggle:hover {
    background: var(--theme-toggle-hover);
    border-color: rgba(59, 130, 246, 0.45);
    transform: translateY(-1px);
}

.theme-toggle:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

html[data-theme="light"] .theme-icon--moon {
    display: none;
}

html[data-theme="light"] .theme-icon--sun {
    display: block;
}

html:not([data-theme="light"]) .theme-icon--sun {
    display: none;
}

html:not([data-theme="light"]) .theme-icon--moon {
    display: block;
}

/* ===== LIGHT MODE: global shell ===== */
html[data-theme="light"] body {
    background: #f3f6fb !important;
    color: #0b1220 !important;
}

html[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.94) !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06) !important;
}

html[data-theme="light"] .navbar-brand,
html[data-theme="light"] .navbar-nav-main a,
html[data-theme="light"] .navbar-nav a,
html[data-theme="light"] .nav-link {
    color: #0b1220 !important;
}

html[data-theme="light"] .navbar-search-icon {
    background: rgba(15, 23, 42, 0.04) !important;
    border-color: rgba(15, 23, 42, 0.10) !important;
    color: #0b1220 !important;
}

html[data-theme="light"] .market-indices-bar {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    color: #0b1220 !important;
}

html[data-theme="light"] .market-index-item,
html[data-theme="light"] .index-name,
html[data-theme="light"] .index-value {
    color: #0b1220 !important;
}

html[data-theme="light"] .btn-login {
    color: #1d4ed8 !important;
    border-color: rgba(37, 99, 235, 0.35) !important;
    background: rgba(37, 99, 235, 0.08) !important;
}

html[data-theme="light"] .mega-footer,
html[data-theme="light"] footer,
html[data-theme="light"] .footer-bottom {
    background: #ffffff !important;
    color: #334155 !important;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .footer-grid {
    border-bottom-color: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .footer-copyright,
html[data-theme="light"] .footer-legal a,
html[data-theme="light"] .mega-footer a {
    color: #475569 !important;
}

html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="email"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="tel"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] input[type="search"],
html[data-theme="light"] textarea,
html[data-theme="light"] select,
html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select {
    color: #0b1220 !important;
    caret-color: #0b1220 !important;
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.14) !important;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
    color: #64748b !important;
}

/* ===== LIGHT MODE: login / auth (phone_login + shared) ===== */
html[data-theme="light"] .auth-shell {
    background:
        radial-gradient(ellipse 650px 380px at 85% -8%, rgba(37, 99, 235, 0.12), transparent 55%),
        radial-gradient(ellipse 550px 300px at 8% 108%, rgba(14, 165, 233, 0.08), transparent 50%),
        linear-gradient(160deg, #f7f9fc 0%, #eef3f9 55%, #e8eef7 100%) !important;
}

html[data-theme="light"] .auth-container {
    background: linear-gradient(135deg, #f7f9fc 0%, #eef3f9 50%, #e8eef7 100%) !important;
}

html[data-theme="light"] .auth-container::before {
    background: radial-gradient(circle, rgba(37, 99, 235, 0.10) 0%, transparent 70%) !important;
}

html[data-theme="light"] .auth-card {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.10) !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.10) !important;
}

html[data-theme="light"] .auth-card:hover {
    border-color: rgba(37, 99, 235, 0.28) !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12) !important;
}

html[data-theme="light"] .auth-title {
    background: none !important;
    -webkit-text-fill-color: #0b1220 !important;
    color: #0b1220 !important;
}

html[data-theme="light"] .auth-subtitle,
html[data-theme="light"] .form-label,
html[data-theme="light"] .auth-helper,
html[data-theme="light"] .auth-footer,
html[data-theme="light"] .auth-divider,
html[data-theme="light"] .auth-card p,
html[data-theme="light"] .auth-card small,
html[data-theme="light"] .safe-text,
html[data-theme="light"] .signup-note,
html[data-theme="light"] .divider-text {
    color: #475569 !important;
}

html[data-theme="light"] .auth-card h1,
html[data-theme="light"] .auth-card h2,
html[data-theme="light"] .auth-card h3 {
    color: #0b1220 !important;
}

html[data-theme="light"] .badge {
    background: rgba(37, 99, 235, 0.10) !important;
    border-color: rgba(37, 99, 235, 0.22) !important;
    color: #1d4ed8 !important;
}

html[data-theme="light"] .step-chip {
    background: #f8fafc !important;
    border-color: rgba(15, 23, 42, 0.10) !important;
    color: #64748b !important;
}

html[data-theme="light"] .step-chip.active {
    background: rgba(37, 99, 235, 0.10) !important;
    border-color: rgba(37, 99, 235, 0.35) !important;
    color: #1d4ed8 !important;
}

html[data-theme="light"] .step-chip.completed {
    background: rgba(5, 150, 105, 0.08) !important;
    border-color: rgba(5, 150, 105, 0.28) !important;
    color: #047857 !important;
}

html[data-theme="light"] .step-dot {
    background: rgba(15, 23, 42, 0.08) !important;
    color: #64748b !important;
}

html[data-theme="light"] .hint,
html[data-theme="light"] .step-hint,
html[data-theme="light"] .auth-step-box,
html[data-theme="light"] .login-step-note {
    background: rgba(37, 99, 235, 0.08) !important;
    border-color: rgba(37, 99, 235, 0.20) !important;
    color: #1d4ed8 !important;
}

html[data-theme="light"] .phone-input,
html[data-theme="light"] .phone-input-wrap,
html[data-theme="light"] .mpin-input,
html[data-theme="light"] .otp-input,
html[data-theme="light"] .digit-box,
html[data-theme="light"] .country-select,
html[data-theme="light"] .auth-input,
html[data-theme="light"] .auth-card input {
    background: #f8fafc !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
    color: #0b1220 !important;
}

html[data-theme="light"] .country-select {
    background-color: #f8fafc !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 10px !important;
}

html[data-theme="light"] .country-select option {
    background: #ffffff !important;
    color: #0b1220 !important;
}

html[data-theme="light"] .digit-box:focus,
html[data-theme="light"] .digit-box.filled {
    background: rgba(5, 150, 105, 0.06) !important;
}

html[data-theme="light"] .btn-secondary {
    background: #f1f5f9 !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
    color: #334155 !important;
}

html[data-theme="light"] .btn-secondary:hover {
    background: #e2e8f0 !important;
    color: #0b1220 !important;
}

html[data-theme="light"] .links {
    border-top-color: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .links a,
html[data-theme="light"] .signup-note a {
    color: #2563eb !important;
}

html[data-theme="light"] .divider-line {
    background: rgba(15, 23, 42, 0.10) !important;
}

html[data-theme="light"] .auth-tabs .tab,
html[data-theme="light"] .auth-tab,
html[data-theme="light"] .step-tab {
    color: #64748b !important;
    background: #f8fafc !important;
    border-color: rgba(15, 23, 42, 0.10) !important;
}

html[data-theme="light"] .auth-tabs .tab.active,
html[data-theme="light"] .auth-tab.active,
html[data-theme="light"] .step-tab.active {
    color: #1d4ed8 !important;
    background: rgba(37, 99, 235, 0.10) !important;
    border-color: rgba(37, 99, 235, 0.35) !important;
}

html[data-theme="light"] .secure-badge,
html[data-theme="light"] .ssl-badge {
    color: #047857 !important;
}

html[data-theme="light"] .google-btn,
html[data-theme="light"] .btn-google {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    color: #0b1220 !important;
}

html[data-theme="light"] .btn-google:hover {
    background: #f8fafc !important;
    border-color: rgba(15, 23, 42, 0.18) !important;
}

html[data-theme="light"] .top-ticker,
html[data-theme="light"] .partner-ticker,
html[data-theme="light"] .announcement-bar,
html[data-theme="light"] .integration-marquee {
    background: linear-gradient(90deg, #eff6ff 0%, #e0e7ff 50%, #eff6ff 100%) !important;
    color: #1e3a8a !important;
    border-bottom: 1px solid rgba(37, 99, 235, 0.15);
}

html[data-theme="light"] .integration-marquee::before {
    background: linear-gradient(to right, #eff6ff, transparent) !important;
}

html[data-theme="light"] .integration-marquee::after {
    background: linear-gradient(to left, #eff6ff, transparent) !important;
}

html[data-theme="light"] .marquee-item,
html[data-theme="light"] .marquee-text {
    color: #1e3a8a !important;
}

html[data-theme="light"] .marquee-divider {
    color: #94a3b8 !important;
}

html[data-theme="light"] .brand-logo--dark {
    display: none !important;
}

html[data-theme="light"] .brand-logo--light {
    display: block !important;
}

html:not([data-theme="light"]) .brand-logo--light {
    display: none !important;
}

html:not([data-theme="light"]) .brand-logo--dark {
    display: block !important;
}

html[data-theme="light"] .navbar-nav-main .nav-link,
html[data-theme="light"] .nav-dropdown-trigger {
    color: #0b1220 !important;
}

html[data-theme="light"] .navbar-nav-main .nav-link:hover,
html[data-theme="light"] .nav-dropdown-trigger:hover {
    color: #1d4ed8 !important;
    background: rgba(37, 99, 235, 0.08) !important;
}

html[data-theme="light"] .nav-dropdown-trigger i.dropdown-arrow {
    color: #64748b !important;
    opacity: 0.7 !important;
}

/* ===== LIGHT MODE: header mega dropdown (Trading / More) ===== */
html[data-theme="light"] .mega-dropdown,
html[data-theme="light"] .nav-dropdown-menu,
html[data-theme="light"] .dropdown-panel,
html[data-theme="light"] .mega-menu {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.10) !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(15, 23, 42, 0.04) inset !important;
    color: #0b1220 !important;
}

html[data-theme="light"] .mega-dropdown-section h4 {
    color: #64748b !important;
    border-bottom-color: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .mega-dropdown-grid[style*="border-top"] {
    border-top-color: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .mega-dropdown-link {
    color: #334155 !important;
}

html[data-theme="light"] .mega-dropdown-link:hover {
    background: rgba(37, 99, 235, 0.08) !important;
    color: #1d4ed8 !important;
}

html[data-theme="light"] .mega-dropdown-link i {
    color: #2563eb !important;
    opacity: 0.85 !important;
}

html[data-theme="light"] .mega-dropdown-link:hover i {
    opacity: 1 !important;
}

html[data-theme="light"] .nav-dropdown-menu a,
html[data-theme="light"] .mega-menu a,
html[data-theme="light"] .dropdown-panel a {
    color: #334155 !important;
}

html[data-theme="light"] .market-indices-bar {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .market-index-item,
html[data-theme="light"] .index-name,
html[data-theme="light"] .index-value,
html[data-theme="light"] .market-time,
html[data-theme="light"] #marketClock {
    color: #0b1220 !important;
}

html[data-theme="light"] .search-modal,
html[data-theme="light"] .search-drawer,
html[data-theme="light"] .search-drawer-body,
html[data-theme="light"] .search-drawer-header {
    background: #ffffff !important;
    color: #0b1220 !important;
    border-color: rgba(15, 23, 42, 0.10) !important;
}

html[data-theme="light"] .search-drawer-input,
html[data-theme="light"] .search-modal-input,
html[data-theme="light"] .search-drawer-input-wrap {
    background: #f8fafc !important;
    color: #0b1220 !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
}

html[data-theme="light"] .search-drawer-section-title,
html[data-theme="light"] .search-drawer-result-name,
html[data-theme="light"] .search-drawer-quick-link,
html[data-theme="light"] .search-drawer-tag {
    color: #334155 !important;
}

html[data-theme="light"] .search-drawer-result-symbol,
html[data-theme="light"] .search-drawer-result-value {
    color: #0b1220 !important;
}

html[data-theme="light"] .mobile-drawer,
html[data-theme="light"] .user-dropdown,
html[data-theme="light"] .dropdown-menu {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.10) !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14) !important;
    color: #0b1220 !important;
}

html[data-theme="light"] .user-profile-trigger {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.10) 0%, rgba(5, 150, 105, 0.06) 100%) !important;
    border-color: rgba(37, 99, 235, 0.22) !important;
}

html[data-theme="light"] .user-profile-trigger:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.14) 0%, rgba(5, 150, 105, 0.10) 100%) !important;
    border-color: rgba(37, 99, 235, 0.35) !important;
}

html[data-theme="light"] .user-name {
    color: #0b1220 !important;
}

html[data-theme="light"] .user-dropdown-header {
    border-bottom-color: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .user-dropdown-email {
    color: #64748b !important;
}

html[data-theme="light"] .user-dropdown-link,
html[data-theme="light"] .dropdown-item,
html[data-theme="light"] .mobile-drawer a {
    color: #334155 !important;
}

html[data-theme="light"] .user-dropdown-link:hover,
html[data-theme="light"] .dropdown-item:hover {
    background: rgba(37, 99, 235, 0.08) !important;
    color: #1d4ed8 !important;
}

html[data-theme="light"] .user-dropdown-link i {
    color: #2563eb !important;
}

html[data-theme="light"] .user-dropdown-link.logout {
    color: #dc2626 !important;
    border-top-color: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .user-dropdown-link.logout:hover {
    background: rgba(220, 38, 38, 0.08) !important;
    color: #b91c1c !important;
}

html[data-theme="light"] .user-dropdown-link.logout i {
    color: #dc2626 !important;
}

html[data-theme="light"] .user-dropdown-header,
html[data-theme="light"] .user-dropdown-header div {
    color: #0b1220 !important;
}

/* ===== LIGHT MODE: mobile nav drawer (header menu) ===== */
html[data-theme="light"] .mobile-drawer {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 50%, #ffffff 100%) !important;
    border-right-color: rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 0 60px rgba(15, 23, 42, 0.12) !important;
}

html[data-theme="light"] .mobile-drawer-overlay {
    background: rgba(15, 23, 42, 0.35) !important;
}

html[data-theme="light"] .mobile-drawer-header {
    background: rgba(255, 255, 255, 0.98) !important;
    border-bottom-color: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .mobile-drawer-close {
    background: rgba(37, 99, 235, 0.08) !important;
    border-color: rgba(37, 99, 235, 0.18) !important;
}

html[data-theme="light"] .mobile-drawer-close i {
    color: #64748b !important;
}

html[data-theme="light"] .mobile-drawer-section {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .mobile-drawer-section:hover {
    border-color: rgba(37, 99, 235, 0.22) !important;
    background: #f8fafc !important;
}

html[data-theme="light"] .mobile-drawer-section h6 {
    color: #64748b !important;
    border-bottom-color: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .mobile-drawer-link {
    color: #334155 !important;
    background: #f8fafc !important;
    border-color: transparent !important;
}

html[data-theme="light"] .mobile-drawer-link:hover,
html[data-theme="light"] .mobile-drawer-link:active {
    background: rgba(37, 99, 235, 0.08) !important;
    border-color: rgba(37, 99, 235, 0.22) !important;
    color: #1d4ed8 !important;
}

html[data-theme="light"] .mobile-drawer-link i {
    color: #2563eb !important;
}

html[data-theme="light"] .mobile-drawer-btn-login {
    border-color: rgba(37, 99, 235, 0.30) !important;
    background: rgba(37, 99, 235, 0.08) !important;
    color: #1d4ed8 !important;
}

html[data-theme="light"] .mobile-drawer-btn-logout {
    border-color: rgba(220, 38, 38, 0.25) !important;
    background: rgba(220, 38, 38, 0.06) !important;
    color: #dc2626 !important;
}

html[data-theme="light"] .mobile-drawer-user-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(5, 150, 105, 0.06)) !important;
    border-color: rgba(37, 99, 235, 0.18) !important;
}

html[data-theme="light"] .mobile-drawer-user-name {
    color: #0b1220 !important;
}

html[data-theme="light"] .mobile-drawer-user-email {
    color: #64748b !important;
}

html[data-theme="light"] .footer-brand p,
html[data-theme="light"] .footer-grid,
html[data-theme="light"] .footer-col h4,
html[data-theme="light"] .footer-col a,
html[data-theme="light"] .footer-social .social-link {
    color: #334155 !important;
}

html[data-theme="light"] .footer-brand .brand-logo,
html[data-theme="light"] .mobile-drawer-logo .brand-logo {
    height: auto;
    max-height: 40px;
    width: auto;
}

html[data-theme="light"] .navbar-toggler,
html[data-theme="light"] .navbar-toggler-icon,
html[data-theme="light"] #mobileMenuToggle {
    color: #0b1220 !important;
    border-color: rgba(15, 23, 42, 0.15) !important;
}

html[data-theme="light"] .wallet-widget {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(37, 99, 235, 0.08)) !important;
    border-color: rgba(16, 185, 129, 0.28) !important;
    color: #047857 !important;
}

html[data-theme="light"] .wallet-widget:hover {
    color: #047857 !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.15) !important;
}

html[data-theme="light"] .user-menu-btn .user-avatar,
html[data-theme="light"] .navbar-right .user-avatar {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

html[data-theme="light"] .bottom-nav {
    background: rgba(255, 255, 255, 0.96) !important;
    border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .bottom-nav-item,
html[data-theme="light"] .bottom-nav-label {
    color: #475569 !important;
}

html[data-theme="light"] .bottom-nav-item.active,
html[data-theme="light"] .bottom-nav-item.active .bottom-nav-label {
    color: #1d4ed8 !important;
}
