/* ==========================================================================
   G-SIP - Global-Systematic Investment Plan
   Core Design System & Visual Tokens (Redesigned App Frame)
   ========================================================================== */

:root {
    /* Color Palette - Premium Financial Primary Theme */
    --bg-page: #0f172a;               /* Outer page backdrop */
    --bg-app: #0b0f19;                /* Main app container background */
    --bg-card: #121a2b;               /* White/Dark card container */
    --bg-card-solid: #121a2b;
    --bg-card-hover: #1c2841;
    --bg-card-light: rgba(255, 255, 255, 0.04);
    --bg-input: #0d1424;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.4);

    /* Primary Branding & Gradients */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --header-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);

    /* Accent & Status Colors */
    --accent-emerald: #10b981;
    --accent-emerald-light: rgba(16, 185, 129, 0.15);
    --accent-gold: #f59e0b;
    --accent-gold-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --accent-rose: #f43f5e;

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    /* Status Colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);

    /* Radius & Spacing */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions & Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.35);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Dimensions */
    --app-max-width: 480px;
    --bottom-nav-height: 64px;
}

/* Light Theme Support - High Contrast & Crisp Readability */
[data-theme="light"] {
    --bg-page: #e2e8f0;
    --bg-app: #f4f5f7;
    --bg-card: #ffffff;
    --bg-card-solid: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-card-light: #f1f5f9;
    --bg-input: #ffffff;
    --border-color: rgba(0, 0, 0, 0.12);
    --border-hover: rgba(79, 70, 229, 0.5);

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --accent-emerald: #059669;
    --accent-emerald-light: rgba(5, 150, 105, 0.12);
    --accent-gold: #b45309;
    --accent-gold-gradient: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    --accent-rose: #e11d48;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.12);
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --header-gradient: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);

    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.14);
    --warning: #b45309;
    --warning-bg: rgba(245, 158, 11, 0.18);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.12);

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Light Theme High-Contrast Element Overrides */
[data-theme="light"] body {
    color: #0f172a;
}

[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] h5,
[data-theme="light"] h6 {
    color: #0f172a;
}

[data-theme="light"] p {
    color: #334155;
}

[data-theme="light"] .text-secondary {
    color: #334155 !important;
}

[data-theme="light"] .text-muted {
    color: #64748b !important;
}

[data-theme="light"] .text-gold {
    color: #b45309 !important;
}

[data-theme="light"] .text-emerald {
    color: #047857 !important;
}

[data-theme="light"] .text-warning {
    color: #b45309 !important;
}

[data-theme="light"] .text-danger {
    color: #dc2626 !important;
}

[data-theme="light"] .text-primary {
    color: #4338ca !important;
}

[data-theme="light"] .card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

/* Modals Light Theme */
[data-theme="light"] .modal-content,
[data-theme="light"] .modal-container {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="light"] .modal-header {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .modal-header h3,
[data-theme="light"] .modal-header h4 {
    color: #0f172a !important;
}

[data-theme="light"] .modal-close {
    background: rgba(0, 0, 0, 0.06) !important;
    border: 1px solid rgba(0, 0, 0, 0.14) !important;
    color: #1e293b !important;
}

[data-theme="light"] .modal-close:hover,
[data-theme="light"] .modal-close:active {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: #dc2626 !important;
    color: #dc2626 !important;
}

.modal-subcard {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-tab-pills {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .modal-subcard {
    background: #f8fafc !important;
    border: 1px solid rgba(0, 0, 0, 0.09) !important;
}

[data-theme="light"] .modal-tab-pills {
    background: #f1f5f9 !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

/* Badges */
[data-theme="light"] .badge-warning {
    background: rgba(245, 158, 11, 0.18) !important;
    color: #b45309 !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    font-weight: 800;
}

[data-theme="light"] .badge-success {
    background: rgba(16, 185, 129, 0.16) !important;
    color: #047857 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    font-weight: 800;
}

[data-theme="light"] .badge-primary {
    background: rgba(99, 102, 241, 0.16) !important;
    color: #4338ca !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
    font-weight: 800;
}

[data-theme="light"] .badge-info {
    background: rgba(14, 165, 233, 0.14) !important;
    color: #0369a1 !important;
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    font-weight: 800;
}

/* Dashboard Portfolio Summary */
[data-theme="light"] .portfolio-box {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.09) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .portfolio-title {
    color: #475569 !important;
    font-weight: 800 !important;
}

[data-theme="light"] .portfolio-subtitle {
    color: #64748b !important;
    font-weight: 600 !important;
}

[data-theme="light"] .view-options-btn {
    background: rgba(79, 70, 229, 0.08) !important;
    border: 1px solid rgba(79, 70, 229, 0.25) !important;
    color: #4338ca !important;
    font-weight: 700 !important;
}

[data-theme="light"] .view-options-btn:hover {
    background: #4f46e5 !important;
    color: #ffffff !important;
}

/* Spin Banner Card */
[data-theme="light"] .spin-banner-card {
    background: #ffffff !important;
    border: 1.5px solid rgba(245, 158, 11, 0.45) !important;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.1) !important;
}

[data-theme="light"] .spin-banner-title {
    color: #0f172a !important;
    font-weight: 800 !important;
}

[data-theme="light"] .spin-banner-desc {
    color: #475569 !important;
    font-weight: 600 !important;
}

/* Team Page 7-Box Grid & Commission Section */
[data-theme="light"] .team-card-box {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.09) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .team-card-title {
    color: #0f172a !important;
    font-weight: 800 !important;
}

[data-theme="light"] .team-card-val {
    color: #047857 !important;
    font-weight: 800 !important;
}

[data-theme="light"] .team-card-box.box-featured {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%) !important;
    border: 1px solid rgba(99, 102, 241, 0.35) !important;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.12) !important;
}

[data-theme="light"] .team-card-box.box-featured .team-card-title {
    color: #1e1b4b !important;
    font-weight: 800 !important;
}

[data-theme="light"] .referral-rates-card {
    background: #f8fafc !important;
    border: 1px solid rgba(99, 102, 241, 0.25) !important;
}

[data-theme="light"] .referral-rates-heading {
    color: #0f172a !important;
}

[data-theme="light"] .referral-rate-label {
    color: #047857 !important;
}

[data-theme="light"] .referral-rate-pct {
    color: #0f172a !important;
}

[data-theme="light"] .referral-rate-row {
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

/* Team Tier List Items & Modal */
[data-theme="light"] .team-tier-item {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .tier-silver-title {
    color: #334155 !important;
}

[data-theme="light"] .tier-gold-title {
    color: #b45309 !important;
}

[data-theme="light"] .tier-diamond-title {
    color: #0e7490 !important;
}

[data-theme="light"] .tier-platinum-title {
    color: #7e22ce !important;
}

[data-theme="light"] .tier-brilliant-title {
    color: #be185d !important;
}

/* Fixed 5-Tab Bottom Navigation Bar */
[data-theme="light"] .fixed-bottom-nav {
    background: rgba(255, 255, 255, 0.96) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .nav-tab-item {
    color: #64748b !important;
}

[data-theme="light"] .nav-tab-item.active {
    color: #4f46e5 !important;
}

[data-theme="light"] .nav-tab-item:hover {
    color: #1e293b !important;
}

[data-theme="dark"] .fixed-bottom-nav {
    background: rgba(18, 26, 43, 0.96) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35) !important;
}

[data-theme="dark"] .nav-tab-item {
    color: #94a3b8 !important;
}

[data-theme="dark"] .nav-tab-item.active {
    color: #818cf8 !important;
}

/* Floating Notification Center Panel */
[data-theme="light"] .notif-floating-panel {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .notif-panel-header {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .notif-panel-title {
    color: #0f172a !important;
}

[data-theme="light"] .notif-mark-read-btn {
    background: #f1f5f9 !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #334155 !important;
}

[data-theme="light"] .notif-mark-read-btn:hover {
    background: rgba(79, 70, 229, 0.1) !important;
    border-color: #4f46e5 !important;
    color: #4f46e5 !important;
}

[data-theme="light"] .notif-panel-close-btn {
    background: rgba(0, 0, 0, 0.06) !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #334155 !important;
}

[data-theme="light"] .notif-panel-close-btn:hover {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

[data-theme="light"] .notif-item-card {
    background: #f8fafc !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .notif-item-card:hover {
    background: #f1f5f9 !important;
    border-color: rgba(79, 70, 229, 0.3) !important;
}

[data-theme="light"] .notif-item-card.unread {
    border-left: 3px solid #4f46e5 !important;
    background: #eef2ff !important;
}

[data-theme="light"] .notif-item-title {
    color: #0f172a !important;
}

[data-theme="light"] .notif-item-message {
    color: #475569 !important;
}

[data-theme="light"] .notif-item-date {
    color: #64748b !important;
}

[data-theme="light"] .floating-notif-corner-btn {
    background: #ffffff !important;
    border: 1.5px solid rgba(0, 0, 0, 0.12) !important;
    color: #334155 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .floating-notif-corner-btn:hover {
    background: #f8fafc !important;
    border-color: #4f46e5 !important;
    color: #4f46e5 !important;
}

[data-theme="dark"] .notif-panel-title {
    color: #ffffff !important;
}

[data-theme="dark"] .notif-item-title {
    color: #ffffff !important;
}

/* Rewards & Spin Wheel Theme Adaptations */
[data-theme="light"] .spin-entry-box {
    background: #f8fafc !important;
    border: 1px dashed rgba(0, 0, 0, 0.16) !important;
}

[data-theme="light"] .spin-entry-title {
    color: #475569 !important;
}

[data-theme="light"] .spin-buy-btn {
    border-color: rgba(79, 70, 229, 0.3) !important;
    background: rgba(79, 70, 229, 0.06) !important;
    color: #4338ca !important;
}

[data-theme="light"] .spin-buy-btn-gold {
    border-color: rgba(245, 158, 11, 0.35) !important;
    background: rgba(245, 158, 11, 0.1) !important;
    color: #b45309 !important;
}

[data-theme="light"] .remaining-spins-pill {
    background: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
    color: #0f172a !important;
}

[data-theme="light"] .lucky-wheel-container {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .jackpot-hero-card {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
    border: 2px solid rgba(245, 158, 11, 0.4) !important;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.12) !important;
}

[data-theme="light"] .wheel-stage {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .spin-game-header {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #0f172a !important;
}

[data-theme="light"] .package-card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .package-card .package-spins {
    color: #0f172a !important;
}

[data-theme="light"] .package-card .package-price {
    color: #b45309 !important;
}

[data-theme="light"] .ticker-marquee-wrap {
    background: #f1f5f9 !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #334155 !important;
}

/* Package Box View in Total Investments Breakdown */
[data-theme="light"] .package-box-card {
    background: #ffffff !important;
    border: 1.5px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .package-box-title {
    color: #0f172a !important;
}

/* Buttons, Forms & Tables */
[data-theme="light"] .btn-outline {
    border-color: rgba(0, 0, 0, 0.2) !important;
    color: #334155 !important;
}

[data-theme="light"] .btn-outline:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    color: #0f172a !important;
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: rgba(0, 0, 0, 0.18) !important;
}

[data-theme="light"] .data-table th {
    background: #f8fafc !important;
    color: #475569 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .data-table td {
    color: #1e293b !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .chart-filter-btn {
    color: #475569 !important;
    background: #f1f5f9 !important;
}

[data-theme="light"] .chart-filter-btn.active {
    color: #ffffff !important;
    background: #4f46e5 !important;
}

/* Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
    background-color: var(--bg-app);
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Base Icon Sizing to Prevent Layout Shift / CLS and Pop-in Glitches */
i[data-lucide],
svg.lucide,
.lucide {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    stroke-width: 2;
    vertical-align: middle;
    flex-shrink: 0;
    box-sizing: border-box;
}

.brand-header-icon i[data-lucide],
.brand-header-icon svg.lucide {
    width: 24px;
    height: 24px;
}

.header-notif-btn i[data-lucide],
.header-notif-btn svg.lucide,
.theme-toggle-btn i[data-lucide],
.theme-toggle-btn svg.lucide {
    width: 16px;
    height: 16px;
}

/* Instant Smooth Navigation Transition - High 60fps GPU Accelerated */
.page-transition-enter {
    animation: smoothFadeIn 0.12s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: opacity, transform;
}

@keyframes smoothFadeIn {
    from {
        opacity: 0.88;
        transform: translateY(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* App Container Frame */
.app-container {
    width: 100%;
    max-width: var(--app-max-width);
    margin: 0 auto;
    background-color: var(--bg-app);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 24px);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p {
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
}

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-emerald {
    color: var(--accent-emerald);
}

.text-gold {
    color: var(--accent-gold);
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.text-3xs {
    font-size: 0.65rem;
}

/* Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.flex-1 { flex: 1; }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-app); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: var(--radius-full); }

/* Global Hidden Utility */
.hidden, [hidden], .d-none {
    display: none !important;
}
