/* EVCS Light Green Theme — fintech aesthetic with dark-mode support */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Light mode (default) */
  --bg-primary: #F5F7FA;
  --bg-secondary: #ECEEF2;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F9FAFB;
  --accent: #1F7A4C;
  --accent-light: #34B46E;
  --accent-hover: #186640;
  --accent-glow: rgba(31, 122, 76, 0.12);
  --positive: #22C55E;
  --negative: #EF4444;
  --warning: #F59E0B;
  --text-primary: #1A1A2E;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-button: 0 4px 14px rgba(31, 122, 76, 0.35);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.2s ease;
  /* Hero/balance gradient — deeper forest green (from DesignerHub) */
  --gradient-hero: linear-gradient(135deg, #0A3018 0%, #1A5C2E 50%, #2D9E5F 100%);
}

/* ── Dark mode (html.dark) ── dark navy fintech palette ─────────────────── */
html.dark {
  color-scheme: dark;
  --bg-primary:      #0D1B4B;
  --bg-secondary:    #0A1435;
  --bg-card:         #162057;
  --bg-card-hover:   #1E2A6E;
  --accent:          #1E5FFF;
  --accent-light:    #3B82F6;
  --accent-hover:    #1A4FD8;
  --accent-glow:     rgba(30, 95, 255, 0.18);
  --positive:        #22C55E;
  --negative:        #EF4444;
  --warning:         #F59E0B;
  --text-primary:    #FFFFFF;
  --text-secondary:  #9CA3AF;
  --text-muted:      #6B7280;
  --border:          rgba(255, 255, 255, 0.10);
  --border-light:    rgba(255, 255, 255, 0.05);
  --shadow-card:     0 2px 16px rgba(0, 0, 0, 0.45);
  --shadow-button:   0 4px 18px rgba(30, 95, 255, 0.40);
  --gradient-hero:   linear-gradient(135deg, #0A1435 0%, #0D1B4B 50%, #162057 100%);
}
html.dark body { background-color: #0D1B4B; }

/* Dark mode icon swap for theme toggle button */
html.dark .dark-icon-hide { display: none !important; }
html.dark .dark-icon-show { display: block !important; }
html:not(.dark) .dark-icon-hide { display: block !important; }
html:not(.dark) .dark-icon-show { display: none !important; }

/* Dark mode card/input overrides not covered by CSS vars */
html.dark .card,
html.dark .form-control,
html.dark .toast { border-color: var(--border); }
html.dark .data-table th { border-color: var(--border); }
html.dark .data-table td { border-color: var(--border-light); }
html.dark .topbar,
html.dark .sidebar { border-color: var(--border); }
html.dark .bottom-tab-bar { border-color: var(--border); box-shadow: 0 -2px 12px rgba(0,0,0,0.4); }

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

/* Remove focus outline on non-interactive elements; keep it for keyboard nav on buttons/inputs */
h1, h2, h3, h4, h5, h6, p, div, section, span, a:not(:focus-visible) {
  outline: none !important;
}
:focus:not(:focus-visible) { outline: none !important; }
:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

/* Gradient balance card — deeper forest-green gradient */
.balance-card {
  background: var(--gradient-hero);
  border-radius: var(--radius-xl);
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(10, 48, 24, 0.45);
}
.balance-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
}
.balance-card::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -20px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-button);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}
.btn-ghost { background: rgba(0,0,0,0.05); color: var(--text-primary); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* Inputs */
.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 15px;
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--accent-light); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group { margin-bottom: 16px; }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: rgba(34, 197, 94, 0.12); color: #15803D; }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #B45309; }
.badge-danger  { background: rgba(239, 68, 68, 0.12); color: #DC2626; }
.badge-info    { background: rgba(31, 122, 76, 0.12); color: var(--accent); }
.badge-muted   { background: rgba(107, 114, 128, 0.12); color: var(--text-muted); }

/* Typography */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-positive { color: #15803D; }
.text-negative { color: #DC2626; }
.text-accent { color: var(--accent); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-2xl { font-size: 28px; }

/* Utility */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Loading spinner */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  min-width: 280px;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); font-size: 14px; }
.data-table tr:hover td { background: var(--bg-secondary); }
.data-table tr:last-child td { border-bottom: none; }

/* RTL layout support */
[dir="rtl"] .sidebar-nav,
[dir="rtl"] .nav-sidebar { right: 0; left: auto; }
[dir="rtl"] { font-family: 'Segoe UI', Tahoma, Arial, sans-serif; }
[dir="rtl"] .ml-auto { margin-left: 0; margin-right: auto; }
[dir="rtl"] .mr-auto { margin-right: 0; margin-left: auto; }
[dir="rtl"] .text-left { text-align: right; }
[dir="rtl"] .text-right { text-align: left; }
[dir="rtl"] input, [dir="rtl"] textarea, [dir="rtl"] select { text-align: right; direction: rtl; }
[dir="rtl"] .data-table th { text-align: right; }
[dir="rtl"] .data-table td { text-align: right; }
[dir="rtl"] .card-header, [dir="rtl"] .page-header { flex-direction: row-reverse; }
[dir="rtl"] .nav-item { flex-direction: row-reverse; }
[dir="rtl"] .btn-icon { flex-direction: row-reverse; }
/* Inline-start/end logical properties are best, but override for explicit left/right */
[dir="rtl"] [style*="text-align: left"] { text-align: right !important; }
[dir="rtl"] [style*="margin-left: auto"] { margin-left: unset !important; margin-right: auto !important; }
