/* ═══════════════════════════════════════════════════════════
   SarfiPay Design System — Enterprise FinTech UI Framework
   ═══════════════════════════════════════════════════════════ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@700;800;900&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=Noto+Sans+Arabic:wght@300;400;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
    /* Primary Palette */
    --primary-900: #06213f;
    --primary-800: #0a2d56;
    --primary-700: #0d3b6e;
    --primary: #0D3B66;
    --primary-500: #1a5298;
    --primary-400: #2d6bbf;
    --primary-300: #4d8fd6;
    --primary-200: #93c0ea;
    --primary-100: #dbeeff;
    --primary-light: #4d8fd6;
    --primary-rgb: 13, 59, 102;

    /* Secondary — Teal */
    --teal-900: #003d38;
    --teal-700: #006b64;
    --teal: #00A896;
    --teal-400: #00c4b3;
    --teal-200: #7de8df;
    --teal-100: #d0f7f5;
    --teal-rgb: 0, 168, 150;

    /* Accent — Gold */
    --gold: #FFD166;
    --gold-dark: #e6b84c;
    --gold-light: #fff0c0;

    /* Neutrals */
    --gray-950: #080f1a;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f8f9fa;
    --white: #ffffff;

    /* Semantic */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --error: #FF6B6B;
    --error-light: #ffe4e4;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --blue: #3b82f6;
    --blue-100: #dbeafe;
    --orange-100: #ffedd5;

    /* Fintech Premium — Light Theme Variables */
    --text-primary-light: #1A1A1A; 
    --text-secondary-light: #333333; 
    --background-light: #FFFFFF;
    --background-alt-light: #F9F9F9;
    --accent-primary: #0D6EFD;
    --link-color-light: #0D6EFD;

    /* Semantic Tokens (Functional & Adaptive) */
    --background-app: var(--bg);
    --background-surface: var(--surface);
    --background-surface-low: var(--surface-2);
    --background-surface-high: var(--surface-3);
    
    --text-high: var(--gray-900);
    --text-med: var(--gray-700);
    --text-low: var(--gray-500);
    
    --border-soft: rgba(0, 0, 0, 0.05);
    --border-med: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.2);

    /* Glassmorphism System */
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-blur: 12px;
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    /* Original Mappings */
    --bg: #f8f9fa;
    --bg-alt: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --surface-3: #e8edf5;
    --border: rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 30px rgba(0, 168, 150, 0.25);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-institutional: 'IBM Plex Sans', sans-serif;
    --font-arabic: 'Noto Sans Arabic', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-2xl: 40px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
    --duration-fast: 150ms;
    --duration: 250ms;
    --duration-slow: 400ms;
    --duration-xl: 700ms;

    /* Layout for CMS pages */
    --cms-header-height: 480px;

    /* Premium Gradients */
    --grad-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-800) 100%);
    --grad-teal: linear-gradient(135deg, var(--teal) 0%, var(--teal-900) 100%);
    --grad-gold: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    --grad-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    --grad-dark: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);

    /* ── Layout helpers ───── */
    --sidebar-width: 260px;
    --topbar-height: 68px;
    --z-sidebar: 100;
    --z-topbar: 99;
    --z-modal: 1000;
    --z-toast: 2000;

    /* ─────────────────────────────────────────────────────────
       SEMANTIC TOKENS — referenced throughout HTML / CSS / JS
       (previously undefined, causing black-text-on-dark-bg bug)
       ───────────────────────────────────────────────────────── */
    /* Text */
    --text-primary:          #111827;
    --text-secondary:        #374151;
    --text-muted:            #6b7280;
    --text-danger:           #dc2626;

    /* Surfaces / Backgrounds */
    --background-card:       #ffffff;
    --background-modal:      #ffffff;
    --background-secondary:  #f1f5f9;
    --surface-secondary:     #f1f5f9;

    /* Inputs */
    --placeholder:           #9ca3af;
    --input-bg:              #ffffff;
    --input-border:          rgba(0,0,0,0.15);
    --input-focus-ring:      rgba(13,59,102,0.2);

    /* Charts */
    --chart-bg:              var(--primary-100);
    --chart-bar:             linear-gradient(to top, var(--primary), var(--teal));
    --chart-axis:            var(--gray-300);
    --chart-label:           var(--gray-500);

    /* Language switcher */
    --lang-btn-bg:           var(--surface-2);
    --lang-btn-color:        var(--text-secondary);
    --lang-btn-active-bg:    var(--primary);
    --lang-btn-active-color: #ffffff;

    /* Scrollbar */
    --scrollbar-thumb:       var(--gray-300);
    --scrollbar-thumb-hover: var(--gray-400);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 98;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease-out);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ── Hydration & Zero Red Console Fix ── */
[data-i18n] {
    transition: opacity 0.2s ease-in-out;
}

.i18n-loading [data-i18n] {
    opacity: 0;
}

/* ── Premium Effects ──────────────────────────────────────── */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s var(--ease-out);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.8s var(--ease-out);
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.8s var(--ease-out);
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Animated Underline */
.link-animated {
    position: relative;
    display: inline-block;
}

.link-animated::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: currentColor;
    transition: width 0.3s var(--ease-out);
}

.link-animated:hover::after {
    width: 100%;
}

/* ── Dark Mode — complete semantic override ───────────────── */
[data-theme="dark"] {
    --bg: #080b14;
    --bg-alt: #0d121f;
    --surface: #111827;
    --surface-2: #1a2233;
    --surface-3: #232d40;
    --surface-secondary: #1a2233;

    /* Text: all tokens reversed for dark bg */
    --text-primary:   #f9fafb;   /* near-white for body text */
    --text-secondary: #d1d5db;   /* light gray for secondary */
    --text-muted:     #9ca3af;   /* medium gray for captions */
    --text-high:      #f9fafb;
    --text-med:       #d1d5db;
    --text-low:       #9ca3af;
    --text-danger:    #f87171;

    /* Borders */
    --border:         rgba(255, 255, 255, 0.08);
    --border-soft:    rgba(255, 255, 255, 0.04);
    --border-med:     rgba(255, 255, 255, 0.12);
    --border-strong:  rgba(255, 255, 255, 0.2);
    --input-border:   rgba(255, 255, 255, 0.18);
    --input-focus-ring: rgba(77, 143, 214, 0.3);

    /* Card / Modal backgrounds */
    --background-card:      #111827;
    --background-modal:     #1a2233;
    --background-secondary: #1a2233;
    --input-bg:             #1a2233;

    /* Placeholder for inputs */
    --placeholder: #6b7280;

    /* Glassmorphism */
    --glass-bg:     rgba(15, 23, 42, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
    --shadow:    0 8px 30px rgba(0,0,0,0.6);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.8);

    /* Semantic light backgrounds (for badges, statuses) */
    --success-light:  rgba(16, 185, 129, 0.15);
    --warning-light:  rgba(245, 158, 11, 0.15);
    --error-light:    rgba(255, 107, 107, 0.15);
    --info-light:     rgba(59, 130, 246, 0.15);
    --primary-100:    rgba(13, 59, 102, 0.25);
    --teal-100:       rgba(0, 168, 150, 0.15);
    --gold-light:     rgba(255, 209, 102, 0.12);
    --gray-100:       rgba(255,255,255,0.05);

    /* Fintech Premium — Dark Theme Variables */
    --text-primary-dark: #FFFFFF;
    --text-secondary-dark: #EAEAEA;
    --background-dark: #121212;
    --background-alt-dark: #1E1E1E;
    --link-color-dark: #64B5F6;

    /* Charts */
    --chart-bg:    rgba(255,255,255,0.04);
    --chart-axis:  rgba(255,255,255,0.15);
    --chart-label: rgba(255,255,255,0.5);

    /* Language switcher */
    --lang-btn-bg:           rgba(255,255,255,0.08);
    --lang-btn-color:        #d1d5db;
    --lang-btn-active-bg:    var(--primary-400);
    --lang-btn-active-color: #ffffff;

    /* Scrollbar */
    --scrollbar-thumb:       rgba(255,255,255,0.15);
    --scrollbar-thumb-hover: rgba(255,255,255,0.25);
}

/* ── RTL (Arabic) ─────────────────────────────────────────── */
[dir="rtl"] {
    font-family: var(--font-arabic);
}

[dir="rtl"] .flex-row-reverse-rtl {
    flex-direction: row-reverse;
}

[dir="rtl"] .text-start-rtl {
    text-align: right;
}

[dir="rtl"] .text-end-rtl {
    text-align: left;
}

[dir="rtl"] .flip-rtl {
    transform: scaleX(-1);
}

[dir="rtl"] .ms-auto {
    margin-right: auto;
    margin-left: initial;
}

[dir="rtl"] .me-auto {
    margin-left: auto;
    margin-right: initial;
}

/* ── Base Reset ───────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.theme-transitioning,
.theme-transitioning * {
    transition: background 0.4s var(--ease-in-out), 
                color 0.4s var(--ease-in-out), 
                border-color 0.4s var(--ease-in-out), 
                box-shadow 0.4s var(--ease-in-out),
                backdrop-filter 0.4s var(--ease-in-out) !important;
}

.lang-transitioning {
    opacity: 0.8;
    filter: blur(2px);
    transition: all 0.3s ease;
}

img,
video {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input,
textarea,
select {
    font-family: inherit;
}

/* ── Typography ───────────────────────────────────────────── */
.display-1 {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 8vw, 5rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.display-2 {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 6vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.h1 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    line-height: 1.2;
}

.h2 {
    font-size: clamp(1.5rem, 3.5vw, 1.75rem);
    font-weight: 700;
    line-height: 1.25;
}

.h3 {
    font-size: clamp(1.2rem, 2.5vw, 1.375rem);
    font-weight: 600;
    line-height: 1.3;
}

.h4 {
    font-size: clamp(1rem, 2vw, 1.125rem);
    font-weight: 600;
}

.h5 {
    font-size: clamp(0.9rem, 1.5vw, 0.9375rem);
    font-weight: 600;
}

.body-lg {
    font-size: 1.125rem;
}

.body {
    font-size: 1rem;
}

.body-sm {
    font-size: 0.875rem;
}

.caption {
    font-size: 0.75rem;
}

.mono {
    font-family: var(--font-mono);
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.text-white {
    color: var(--white);
}

.text-teal {
    color: var(--teal);
}

.text-gold {
    color: var(--gold);
}

.text-error {
    color: var(--error);
}

.text-success {
    color: var(--success);
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.text-center {
    text-align: center;
}

.text-end {
    text-align: end;
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-lg {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--space-8);
}

.container-sm {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-1 {
    gap: var(--space-1);
}

.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.gap-8 {
    gap: var(--space-8);
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}

.grid {
    display: grid;
}

.section {
    padding: var(--space-24) 0;
}

.section-sm {
    padding: var(--space-16) 0;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius);
    transition: all var(--duration) var(--ease-out);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    -webkit-user-select: none;
    user-select: none;
    min-height: 48px; /* Touch target minimum */
    touch-action: manipulation;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: white;
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.btn:hover::after {
    opacity: 0.08;
}

.btn:active {
    transform: scale(0.97);
}

.btn:active::after {
    opacity: 0.15;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(13, 59, 102, 0.3);
}

.btn-primary:hover {
    background: var(--primary-500);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(13, 59, 102, 0.4);
}

.btn-teal {
    background: var(--teal);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 168, 150, 0.3);
}

.btn-teal:hover {
    background: var(--teal-400);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 168, 150, 0.4);
}

.btn-gold {
    background: var(--gold);
    color: var(--primary-900);
    box-shadow: 0 4px 15px rgba(255, 209, 102, 0.3);
}

.btn-gold:hover {
    background: var(--gold-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 209, 102, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid currentColor;
}

.btn-outline:hover {
    background: var(--primary-100);
    transform: translateY(-2px);
}

.btn-white {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-white:hover {
    background: var(--white);
    filter: brightness(0.95);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}

.btn-danger:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1.1rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 1rem 2.25rem;
    font-size: 1.0625rem;
    border-radius: var(--radius);
}

.btn-xl {
    padding: 1.125rem 2.75rem;
    font-size: 1.125rem;
    border-radius: var(--radius-md);
}

.btn-icon {
    padding: 0.625rem;
    border-radius: var(--radius-sm);
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn.loading {
    pointer-events: none;
}

.btn.loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration) var(--ease-out);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-hover:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.card-flat {
    box-shadow: none;
}

.card-glass {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-teal {
    background: var(--teal-100);
    color: var(--teal-700);
}

.badge-gold {
    background: var(--gold-light);
    color: #8b6200;
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}

.badge-error {
    background: var(--error-light);
    color: #9b1c1c;
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-700);
}

.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--duration-fast);
}

.form-label.required::after {
    content: ' *';
    color: var(--error);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--input-bg, var(--surface));
    color: var(--text-primary);
    border: 1.5px solid var(--input-border, var(--border-strong));
    border-radius: var(--radius);
    font-size: 16px; /* Prevents iOS Safari Zoom */
    transition: all var(--duration-fast);
    outline: none;
    min-height: 48px; /* Touch target minimum */
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--placeholder, #9ca3af);
}

.form-select option {
    background: var(--input-bg, var(--surface));
    color: var(--text-primary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px var(--input-focus-ring, rgba(13,59,102,0.15));
}

.form-input.error {
    border-color: var(--error);
    background: var(--error-light);
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2);
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.form-error {
    font-size: 0.8125rem;
    color: var(--error);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.form-input-icon {
    position: relative;
}

.form-input-icon .form-input {
    padding-inline-start: 2.75rem;
}

.form-input-icon .icon {
    position: absolute;
    inset-inline-start: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-change {
    font-size: 0.8125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.up {
    color: var(--success);
}

.stat-change.down {
    color: var(--error);
}

/* ── Avatars ──────────────────────────────────────────────── */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    background: var(--primary-100);
    color: var(--primary);
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.avatar-lg {
    width: 52px;
    height: 52px;
    font-size: 1rem;
}

.avatar-xl {
    width: 72px;
    height: 72px;
    font-size: 1.375rem;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
}

.divider-vertical {
    width: 1px;
    background: var(--border);
    align-self: stretch;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes countUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes orbit {
    from {
        transform: rotate(0deg) translateX(80px);
    }

    to {
        transform: rotate(360deg) translateX(80px);
    }
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 20px var(--teal-200);
    }

    50% {
        box-shadow: 0 0 40px var(--teal);
    }
}

.animate-fadeIn {
    animation: fadeIn var(--duration-slow) var(--ease-out) both;
}

.animate-fadeUp {
    animation: fadeUp var(--duration-slow) var(--ease-out) both;
}

.animate-fadeDown {
    animation: fadeDown var(--duration-slow) var(--ease-out) both;
}

.animate-slideRight {
    animation: slideRight var(--duration-slow) var(--ease-out) both;
}

.animate-slideLeft {
    animation: slideLeft var(--duration-slow) var(--ease-out) both;
}

.animate-scaleIn {
    animation: scaleIn var(--duration-slow) var(--ease-out) both;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

.delay-400 {
    animation-delay: 400ms;
}

.delay-500 {
    animation-delay: 500ms;
}

.delay-700 {
    animation-delay: 700ms;
}

/* ── Skeleton Loading ─────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb, var(--gray-300));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover, var(--gray-400));
}

/* ── Utility ──────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.inset-0 {
    inset: 0;
}

.overflow-hidden {
    overflow: hidden;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.min-h-screen {
    min-height: 100vh;
}

.rounded-full {
    border-radius: var(--radius-full);
}

.shadow {
    box-shadow: var(--shadow);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .hide-lg {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .hide-md {
        display: none !important;
    }

    .container {
        padding: 0 var(--space-4);
    }
}

@media (max-width: 480px) {
    .hide-sm {
        display: none !important;
    }

    .container {
        padding: 0 var(--space-3);
    }
}

/* ── Phase 4: Final Polish Mobile Overrides ── */
@media (max-width: 768px) {
    .dash-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-4);
    }
    
    .bill-widget, .service-card, .recharge-option {
        flex-direction: column !important;
        text-align: center;
        padding: var(--space-6) !important;
    }

    .service-icon-3d {
        width: 80px !important;
        height: 80px !important;
        margin-bottom: var(--space-4);
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s var(--ease-out);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* RTL Support for small screens */
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    [dir="rtl"] .sidebar.active {
        transform: translateX(0);
    }
}

/* Fix for overlapping cards on iPad */
@media (min-width: 769px) and (max-width: 1024px) {
    .dash-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* RTL Force directional flow */
[dir="rtl"] {
    text-align: start;
    font-family: var(--font-arabic), var(--font-sans);
}

[dir="rtl"] .nav-icon {
    margin-inline-end: var(--space-2);
    margin-inline-start: 0;
}
