/**
 * MAHAM FinTech Platform - Luxury Iraqi FinTech Design System
 * Primary Typography: 'Cairo' & 'Tajawal'
 * Palette: Deep Obsidian (#070b14), Dark Surface (#0b111a), Emerald Green (#10b981), Amber Gold (#f59e0b) & Crimson Ruby (#e11d48)
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Tajawal:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700;800&display=swap');

:root {
    --font-primary: 'Cairo', 'Tajawal', system-ui, -apple-system, sans-serif;
    --font-heading: 'Cairo', 'Tajawal', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --color-bg: #070b14;
    --color-surface: #0b111a;
    --color-surface-hover: rgba(22, 33, 49, 0.95);
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-hover: rgba(255, 255, 255, 0.16);
    --color-emerald: #10b981;
    --color-emerald-glow: rgba(16, 185, 129, 0.28);
    --color-crimson: #e11d48;
    --color-gold: #f59e0b;
    --color-amber: #f59e0b;
    --color-slate-dark: #1e293b;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body, button, input, select, textarea, p, h1, h2, h3, h4, h5, h6, span, a, label, div {
    font-family: var(--font-primary);
}

.font-mono, [class*="font-mono"], code, pre {
    font-family: var(--font-mono) !important;
}

html {
    scroll-behavior: smooth;
    overflow-x: clip;
}

body {
    background-color: var(--color-bg);
    color: #f1f5f9;
    overflow-x: clip;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* ========================================================================= */
/* DEFAULT DARK MODE & OPTIONAL LIGHT MODE THEME ENGINE */
/* ========================================================================= */
header {
    background-color: rgba(11, 17, 26, 0.92) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

header h1, header .current-user-name {
    color: #ffffff !important;
}

.glass-panel {
    background: rgba(11, 17, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.25rem;
    color: #f8fafc;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.16);
}

/* OPTIONAL LIGHT MODE OVERRIDES */
html.light {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-surface-hover: #f1f5f9;
    --color-border: #e2e8f0;
    --color-border-hover: #cbd5e1;
    color-scheme: light;
}

html.light body {
    background-color: #f8fafc;
    color: #1e293b;
}

html.light header {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border-color: #e2e8f0 !important;
}

html.light header h1, html.light header .current-user-name {
    color: #0f172a !important;
}

html.light .glass-panel {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

html.light .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.96) !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08) !important;
}

html.light .mobile-bottom-nav .nav-tab-btn {
    color: #64748b !important;
}

html.light .mobile-bottom-nav .nav-tab-btn.active {
    color: #059669 !important;
    background: rgba(5, 150, 105, 0.1) !important;
}

/* ========================================================================= */
/* ADMIN COMMAND CENTER - LIGHT & DARK MODE ENGINE */
/* ========================================================================= */
html:not(.dark) aside {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

html:not(.dark) aside h2,
html:not(.dark) aside .text-white {
    color: #0f172a !important;
}

html:not(.dark) aside .bg-slate-900 {
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

html:not(.dark) main h2,
html:not(.dark) main h3,
html:not(.dark) main h4 {
    color: #0f172a !important;
}

html:not(.dark) .glass-panel {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

html:not(.dark) .glass-panel .text-white {
    color: #0f172a !important;
}

html:not(.dark) table {
    border-color: #e2e8f0 !important;
}

html:not(.dark) th {
    background-color: #f8fafc !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}

html:not(.dark) td {
    color: #1e293b !important;
    border-color: #f1f5f9 !important;
}

html:not(.dark) tr:hover td {
    background-color: #f8fafc !important;
}

html:not(.dark) input:not([type="checkbox"]),
html:not(.dark) select,
html:not(.dark) textarea {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

html:not(.dark) input::placeholder,
html:not(.dark) textarea::placeholder {
    color: #94a3b8 !important;
}

html:not(.dark) #admin-auth-guard {
    background-color: rgba(248, 250, 252, 0.98) !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: #070b14;
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

html.light ::-webkit-scrollbar-track {
    background: #f1f5f9;
}
html.light ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}
html.light ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Digital Luxury Card (FinTech Visa/MasterCard styling) */
.fintech-card {
    background: linear-gradient(135deg, #0d1b2e 0%, #091220 50%, #060a12 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 30px -10px rgba(16, 185, 129, 0.15);
    border-radius: 1.5rem;
    position: relative;
    overflow: hidden;
}

.fintech-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0) 70%);
    pointer-events: none;
}

/* Ambient Radial Background Glows */
.ambient-glow-emerald {
    position: fixed;
    top: -120px;
    right: -80px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.14) 0%, rgba(16, 185, 129, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

.ambient-glow-crimson {
    position: fixed;
    bottom: -120px;
    left: -80px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(225, 29, 72, 0.10) 0%, rgba(225, 29, 72, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

/* ========================================================================= */
/* CINEMATIC SPLASH SCREEN (Opaque & Standalone Dismissal) */
/* ========================================================================= */
#splash-screen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: #060911 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    opacity: 1;
    visibility: visible;
}

#splash-screen.splash-exit {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    display: none !important;
}

#auth-modal {
    z-index: 1000000 !important;
}

.splash-emblem {
    animation: emblemPulse 1.8s ease-in-out infinite alternate;
}

@keyframes emblemPulse {
    0% {
        transform: scale(0.96);
        box-shadow: 0 0 25px rgba(16, 185, 129, 0.2);
    }
    100% {
        transform: scale(1.04);
        box-shadow: 0 0 50px rgba(16, 185, 129, 0.5), 0 0 80px rgba(225, 29, 72, 0.25);
    }
}

.splash-text-reveal {
    animation: textFadeInUp 0.8s ease-out forwards;
}

@keyframes textFadeInUp {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================================================= */
/* FLOATING BOTTOM NAVIGATION BAR (Strict Viewport Docking) */
/* ========================================================================= */
.mobile-bottom-nav {
    position: fixed !important;
    bottom: 14px !important;
    left: 14px !important;
    right: 14px !important;
    max-width: 460px !important;
    margin: 0 auto !important;
    z-index: 99999 !important;
    background: rgba(11, 17, 30, 0.96) !important;
    backdrop-filter: blur(28px) !important;
    -webkit-backdrop-filter: blur(28px) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 1.5rem !important;
    box-shadow: 0 16px 40px -5px rgba(0, 0, 0, 0.85), 0 0 1px 1px rgba(255, 255, 255, 0.1) !important;
    padding: 6px 8px !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
}

.nav-tab-btn {
    position: relative;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 1rem;
    padding: 6px 2px;
}

.nav-tab-btn.active {
    color: #10b981 !important;
    background: rgba(16, 185, 129, 0.1) !important;
}

.nav-tab-btn.active .nav-indicator {
    opacity: 1;
    transform: scaleX(1);
}

.nav-indicator {
    position: absolute;
    bottom: 2px;
    left: 25%;
    right: 25%;
    height: 3px;
    background: #10b981;
    border-radius: 9999px;
    box-shadow: 0 0 10px #10b981;
    opacity: 0;
    transform: scaleX(0);
    transition: all 0.25s ease;
}

/* Circular Timer Progress Ring */
.progress-ring__circle {
    transition: stroke-dashoffset 0.35s linear;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

/* Currency Subtext */
.currency-iqd {
    font-size: 0.8em;
    font-weight: 700;
    color: #94a3b8;
    margin-right: 0.2rem;
}

/* Custom Notification Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000000 !important;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 92%;
    max-width: 400px;
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    background: rgba(11, 17, 30, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.7);
    border-radius: 1.25rem;
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
