/* ─── Ride-Hailing Monitoring Design System ───
   Tokens match the original shadcn/ui dark theme exactly.
   Primary: indigo/purple oklch(0.6 0.2 265) ≈ #6366f1
   ─────────────────────────────────── */

/* ─── Design Tokens ─── */
:root {
  --background: #0f0f17;
  --foreground: #f0f0f0;
  --card: #181825;
  --card-foreground: #f0f0f0;
  --popover: #181825;
  --popover-foreground: #f0f0f0;
  --primary: #6366f1;
  --primary-hover: #5558e6;
  --primary-foreground: #0f0f17;
  --secondary: #252533;
  --secondary-foreground: #f0f0f0;
  --muted: #252533;
  --muted-foreground: #8c8c94;
  --accent: #252533;
  --accent-foreground: #f0f0f0;
  --destructive: #ef4444;
  --destructive-hover: #dc2626;
  --destructive-foreground: #f0f0f0;
  --border: #2a2a3a;
  --input: #2a2a3a;
  --ring: #6366f1;
  --radius: 0.75rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-lg: calc(var(--radius) + 4px);

  /* Chart colors */
  --chart-1: #6366f1;
  --chart-2: #22c55e;
  --chart-3: #f59e0b;
  --chart-4: #3b82f6;
  --chart-5: #ef4444;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 0px;
  --header-height: 64px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--muted-foreground); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--foreground); }

/* ─── Layout ─── */
.sidebar {
  width: var(--sidebar-width); min-width: var(--sidebar-width);
  height: 100vh; position: sticky; top: 0;
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 50;
  transition: width 0.25s cubic-bezier(0.4,0,0.2,1), min-width 0.25s cubic-bezier(0.4,0,0.2,1);
}
.sidebar.collapsed { width: 70px; min-width: 70px; }
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-height); padding: 0 16px;
  border-bottom: 1px solid var(--border); position: relative;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.logo-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-icon img { width: 26px; height: 26px; object-fit: contain; }
.logo-text { white-space: nowrap; overflow: hidden; transition: opacity 0.2s; font-size: 0.9em; }
.sidebar.collapsed .logo-text { opacity: 0; width: 0; }
.sidebar-toggle-btn {
  position: absolute; right: -12px; top: 20px; z-index: 10;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--card);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-foreground); font-size: 12px;
  box-shadow: var(--shadow-sm); transition: all 0.2s;
}
.sidebar-toggle-btn:hover { background: var(--accent); color: var(--foreground); }
.sidebar.collapsed .sidebar-toggle-btn svg { transform: rotate(180deg); }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  color: var(--muted-foreground); transition: all 0.15s; position: relative;
}
.sidebar-link:hover { color: var(--foreground); background: var(--accent); }
.sidebar-link.active { color: var(--primary); background: rgba(99,102,241,0.1); font-weight: 600; }
.sidebar-link.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; background: var(--primary); border-radius: 0 3px 3px 0;
}
.nav-label { white-space: nowrap; overflow: hidden; transition: opacity 0.2s; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 9px; }
.sidebar-footer { padding: 8px; border-top: 1px solid var(--border); }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.header {
  height: var(--header-height); display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; border-bottom: 1px solid var(--border);
  background: rgba(15,15,23,0.85); backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 40; gap: 16px;
}
.header-left { display: flex; align-items: center; gap: 12px; flex: 1; max-width: 420px; }
.header-right { display: flex; align-items: center; gap: 6px; }
.header-search { position: relative; flex: 1; }
@media (max-width: 640px) { .header-search { display: none; } }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.search-input {
  width: 100%; padding: 7px 12px 7px 36px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--muted);
  color: var(--foreground); font-size: 14px; transition: all 0.15s;
}
.search-input:focus { outline: none; border-color: var(--ring); background: var(--card); box-shadow: 0 0 0 2px rgba(99,102,241,0.15); }
.user-info { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--muted-foreground); }
.user-info svg { color: var(--muted-foreground); }
@media (max-width: 639px) { .user-info span { display: none; } }
.main-content { flex: 1; padding: 28px 32px; overflow-y: auto; }
@media (max-width: 768px) { .main-content { padding: 20px 16px; } }
.mobile-menu-btn { display: none; background: none; border: none; padding: 4px; border-radius: var(--radius-sm); color: var(--muted-foreground); }
.mobile-menu-btn:hover { background: var(--accent); color: var(--foreground); }
@media (max-width: 767px) { .sidebar { display: none; } .mobile-menu-btn { display: flex; } }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 49; }
.sidebar-overlay.hidden { display: none; }

/* ─── Cards ─── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover { box-shadow: var(--shadow); }
.card-header { padding: 20px 24px 16px; }
.card-header:has(+ .card-body) { padding-bottom: 0; }
.card-body { padding: 20px 24px; }
.card-body.p-0 { padding: 0; }
.card-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--foreground); }
.card-description { font-size: 14px; color: var(--muted-foreground); margin-top: 4px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  border: 1px solid transparent; transition: all 0.15s; white-space: nowrap;
  letter-spacing: -0.01em;
}
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 1px 2px rgba(99,102,241,0.3); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(99,102,241,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-danger { background: var(--destructive); color: white; }
.btn-danger:hover { background: var(--destructive-hover); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--foreground); }
.btn-outline:hover { background: var(--accent); border-color: var(--muted-foreground); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted-foreground); }
.btn-ghost:hover { background: var(--accent); color: var(--foreground); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: calc(var(--radius-sm) - 1px); }
.btn-lg { padding: 10px 20px; font-size: 15px; border-radius: var(--radius); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-danger-outline { background: transparent; border-color: var(--destructive); color: var(--destructive); }
.btn-danger-outline:hover { background: var(--destructive); color: white; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm); border: none;
  background: transparent; color: var(--muted-foreground); font-size: 15px;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--accent); color: var(--foreground); }
.icon-btn.text-red:hover { background: rgba(239,68,68,0.12); color: var(--destructive); }

/* ─── Forms ─── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--foreground); }
.form-input, .form-select {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--input); background: var(--background);
  color: var(--foreground); font-size: 14px; transition: all 0.15s;
}
.form-input:focus, .form-select:focus {
  outline: none; border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-input[type="date"] {
  cursor: pointer; color-scheme: dark;
  min-height: 37px;
}
.form-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7); cursor: pointer;
}
.form-input::placeholder { color: var(--muted-foreground); }
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238c8c94' stroke-width='2'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-error { color: var(--destructive); font-size: 13px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.password-wrapper { position: relative; }
.password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted-foreground); padding: 4px; }
.password-toggle:hover { color: var(--foreground); }
.scope-btn { flex: 1; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--muted-foreground); font-size: 14px; font-weight: 500; transition: all 0.15s; }
.scope-btn:hover { background: var(--accent); }
.scope-btn.active { background: rgba(99,102,241,0.1); border-color: var(--primary); color: var(--primary); }
.scope-btn[style*="--c"] { border-color: var(--border); }
.scope-btn[style*="--c"].active { background: color-mix(in srgb, var(--c) 15%, transparent); border-color: var(--c); color: var(--c); }
.search-box { margin-bottom: 20px; }
.search-input-lg { padding: 10px 16px; font-size: 14px; max-width: 380px; }

/* ─── Tables ─── */
.table { width: 100%; border-collapse: collapse; }
.table thead th {
  padding: 12px 20px; text-align: left; font-size: 13px; font-weight: 600;
  color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border); background: rgba(37,37,51,0.4);
}
.table tbody td { padding: 13px 20px; font-size: 14px; border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: rgba(37,37,51,0.3); }
.table-container { overflow-x: auto; border-radius: var(--radius); }

/* ─── Grid ─── */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1200px) { .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; } .grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px) { .grid-6 { grid-template-columns: repeat(2, 1fr); } }

/* ─── Badges ─── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-success { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.badge-danger { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.badge-warning { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.badge-secondary { background: var(--muted); color: var(--muted-foreground); }
.badge-outline { border: 1px solid var(--border); color: var(--muted-foreground); background: transparent; }
.badge-snapp { background: rgba(0,200,111,0.15); color: #00C86F; border: 1px solid rgba(0,200,111,0.3); }
.badge-tapsi { background: rgba(255,193,7,0.15); color: #FF5722; border: 1px solid rgba(255,193,7,0.3); }

/* ─── Progress ─── */
.progress-bar { height: 8px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.4s cubic-bezier(0.4,0,0.2,1); }

/* ─── Modal ─── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn 0.15s ease; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); }
.modal-content {
  position: relative; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 480px;
  max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; }
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 24px; color: var(--muted-foreground); width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--accent); color: var(--foreground); }
.modal-body { padding: 0 24px 24px; }

/* ─── Logs ─── */
.log-container {
  height: 380px; overflow-y: auto; font-family: var(--font-mono); font-size: 12px;
  background: var(--background); border-radius: var(--radius-sm);
  padding: 12px 16px; line-height: 1.8;
}
.log-entry { padding: 1px 0; }
.log-time { color: rgba(140,140,148,0.4); margin-right: 10px; }
.log-info { color: var(--muted-foreground); }
.log-success { color: #4ade80; }
.log-error { color: #f87171; }
.log-warning { color: #fbbf24; }

/* ─── Toast ─── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 12px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  pointer-events: auto; box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
}
.toast-success { background: #16a34a; color: white; }
.toast-error { background: var(--destructive); color: white; }

/* ─── Login ─── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.1) 0%, transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(139,92,246,0.06) 0%, transparent 55%),
    var(--background);
}
.login-container { width: 100%; max-width: 384px; animation: slideUp 0.4s ease; }
.login-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.03);
}
.login-header { text-align: center; padding: 40px 28px 0; }
.login-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 104px; height: 104px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(99,102,241,0.18);
}
.login-logo img { width: 78px; height: 78px; object-fit: contain; }
.login-header h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.04em; }
.login-header p { color: var(--muted-foreground); font-size: 14px; margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 16px; padding: 28px 28px 32px; }
.login-form .form-group { margin-bottom: 0; }
.login-form .form-group label { font-size: 14px; font-weight: 500; margin-bottom: 5px; }
.login-form .form-input {
  height: 40px; padding: 8px 12px; font-size: 14px;
  border-radius: var(--radius-sm);
}
.login-form .btn {
  height: 40px; font-size: 14px; font-weight: 600; margin-top: 4px;
}

/* ─── Page Header ─── */
.page-header { margin-bottom: 28px; display: flex; align-items: flex-start; }
.page-header h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; }
.page-header p { color: var(--muted-foreground); font-size: 15px; margin-top: 4px; }

/* ─── Mode Toggle ─── */
.mode-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.mode-btn {
  padding: 8px 18px; font-size: 14px; font-weight: 500; border: none;
  background: transparent; color: var(--muted-foreground); cursor: pointer;
  transition: all 0.15s;
}
.mode-btn:first-child { border-right: 1px solid var(--border); }
.mode-btn.active { background: var(--primary); color: white; }
.mode-btn:not(.active):hover { background: var(--accent); color: var(--foreground); }

/* ─── Stats Row (5 cards in one row) ─── */
.stats-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stats-row .card-body { padding: 14px 16px; }
@media (max-width: 1100px) { .stats-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }

/* ─── Execution Actions ─── */
.exec-actions { display: flex; align-items: center; gap: 12px; padding-top: 4px; }

/* ─── City Cards ─── */
.city-card { overflow: hidden; }
.city-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; cursor: pointer; transition: background 0.15s;
}
.city-card-header:hover { background: var(--accent); }
.city-card-body { padding: 0 24px 20px; border-top: 1px solid var(--border); }
.city-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(34,197,94,0.1); display: flex;
  align-items: center; justify-content: center; font-size: 18px;
}
.chevron { transition: transform 0.2s; display: inline-block; color: var(--muted-foreground); font-size: 14px; }
.chevron.rotated { transform: rotate(90deg); }
.routes-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.route-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--background);
  transition: border-color 0.15s;
}
.route-item:hover { border-color: var(--muted-foreground); }
.route-coords { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.route-coords code { font-size: 12px; color: var(--muted-foreground); font-family: var(--font-mono); }
.route-actions { display: flex; align-items: center; gap: 1px; }

/* ─── Route Map ─── */
#route-map { height: 500px; width: 100%; z-index: 1; }

/* ─── Ratio Highlight ─── */
.ratio-highlight {
  text-align: center; padding: 10px 0; margin: 4px 0;
  background: linear-gradient(135deg, rgba(0,200,111,0.08), rgba(255,193,7,0.08));
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
}
.ratio-highlight span { display: block; font-size: 11px; font-weight: 500; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.06em; }

/* ─── Execution Cards ─── */
.exec-card-wrapper {
  display: flex; flex-direction: column; overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}
.exec-card-wrapper:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  border-color: rgba(99,102,241,0.25);
}
.exec-card-link { display: block; color: inherit; text-decoration: none; }
.exec-card-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 0 20px 16px; opacity: 0; transition: opacity 0.15s;
}
.exec-card-wrapper:hover .exec-card-actions { opacity: 1; }

/* ─── Status Bar ─── */
.status-bar .card-body { display: flex; align-items: center; gap: 28px; padding: 14px 24px; }

/* ─── Animations ─── */
.spinner { display: inline-block; width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ─── Utilities ─── */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.items-center { align-items: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mr-1 { margin-right: 4px; }
.ml-2 { margin-left: 8px; }
.p-0 { padding: 0; }
.p-3 { padding: 12px; }
.pt-2 { padding-top: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.py-20 { padding-top: 80px; padding-bottom: 80px; }
.py-40 { padding-top: 160px; padding-bottom: 160px; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 28px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted-foreground); }
.text-emerald { color: #4ade80; }
.text-red { color: #f87171; }
.text-amber { color: #fbbf24; }
.text-blue { color: #60a5fa; }
.text-primary { color: var(--primary); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }
.block { display: block; }
.inline-flex { display: inline-flex; }
.hidden { display: none !important; }
.rounded { border-radius: var(--radius); }
.bg-muted { background: var(--muted); }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.whitespace-nowrap { white-space: nowrap; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }

/* ─── Token Preview ─── */
.token-preview { background: var(--muted); padding: 3px 10px; border-radius: var(--radius-sm); font-size: 12px; font-family: var(--font-mono); color: var(--muted-foreground); }

/* ─── IranSansX Webfont ─── */
@font-face { font-family: IRANSansX; font-style: normal; font-weight: 300; src: url('../fonts/IRANSansX-Light.woff2') format('woff2'), url('../fonts/IRANSansX-Light.woff') format('woff'); }
@font-face { font-family: IRANSansX; font-style: normal; font-weight: 400; src: url('../fonts/IRANSansX-Regular.woff2') format('woff2'), url('../fonts/IRANSansX-Regular.woff') format('woff'); }
@font-face { font-family: IRANSansX; font-style: normal; font-weight: 500; src: url('../fonts/IRANSansX-Medium.woff2') format('woff2'), url('../fonts/IRANSansX-Medium.woff') format('woff'); }
@font-face { font-family: IRANSansX; font-style: normal; font-weight: 600; src: url('../fonts/IRANSansX-DemiBold.woff2') format('woff2'), url('../fonts/IRANSansX-DemiBold.woff') format('woff'); }
@font-face { font-family: IRANSansX; font-style: normal; font-weight: 700; src: url('../fonts/IRANSansX-Bold.woff2') format('woff2'), url('../fonts/IRANSansX-Bold.woff') format('woff'); }

/* ─── RTL / Persian Layout ─── */
[dir="rtl"] body,
[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea,
[dir="rtl"] button { font-family: 'IRANSansX', -apple-system, BlinkMacSystemFont, sans-serif; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4 { letter-spacing: 0; }
[dir="rtl"] .btn, [dir="rtl"] .badge, [dir="rtl"] .sidebar-link { letter-spacing: 0; }
[dir="rtl"] .table thead th { letter-spacing: 0; }
/* Sidebar on right */
[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .sidebar-toggle-btn { right: auto; left: -12px; }
[dir="rtl"] .sidebar-toggle-btn svg { transform: rotate(180deg); }
[dir="rtl"] .sidebar.collapsed .sidebar-toggle-btn svg { transform: rotate(0deg); }
[dir="rtl"] .sidebar-link.active::before { left: auto; right: 0; border-radius: 3px 0 0 3px; }
/* Header search */
[dir="rtl"] .search-icon { left: auto; right: 12px; }
[dir="rtl"] .search-input { padding-left: 12px; padding-right: 36px; }
/* Forms */
[dir="rtl"] .form-select { background-position: left 12px center; padding-right: 12px; padding-left: 36px; }
[dir="rtl"] .password-toggle { right: auto; left: 10px; }
/* Table */
[dir="rtl"] .table thead th { text-align: right; }
[dir="rtl"] .table tbody td { text-align: right; }
/* Mode toggle */
[dir="rtl"] .mode-btn:first-child { border-right: none; border-left: 1px solid var(--border); }
/* Toast */
[dir="rtl"] .toast-container { right: auto; left: 24px; }
/* Logs */
[dir="rtl"] .log-time { margin-right: 0; margin-left: 10px; }
/* Keep numbers/code LTR */
[dir="rtl"] .font-mono,
[dir="rtl"] code,
[dir="rtl"] .token-preview,
[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="date"] { direction: ltr; unicode-bidi: embed; text-align: left; }

/* Pages where sidebar is RTL but main content stays LTR (untranslated dynamic content) */
[dir="rtl"].content-ltr .main-content {
  direction: ltr;
  text-align: left;
  font-family: var(--font-sans);
}
[dir="rtl"].content-ltr .main-content * {
  direction: ltr;
}

/* FF Results & Price Results: cards at bottom stay LTR (English dynamic content) */
[dir="rtl"] #exec-grid {
  direction: ltr;
  text-align: left;
  font-family: var(--font-sans);
}
[dir="rtl"] #exec-grid * {
  direction: ltr;
}

/* ─── Language Settings Page ─── */
.lang-card {
  cursor: pointer; transition: all 0.2s; border: 2px solid var(--border);
  padding: 32px 24px; text-align: center; border-radius: var(--radius-lg);
  background: var(--card);
}
.lang-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lang-card.active { border-color: var(--primary); background: rgba(99,102,241,0.07); }
.lang-card .lang-flag { font-size: 40px; display: block; margin-bottom: 12px; }
.lang-card .lang-name { font-size: 20px; font-weight: 700; display: block; margin-bottom: 4px; }
.lang-card .lang-label { font-size: 14px; color: var(--muted-foreground); display: block; }

/* ─── Brand Icons ─── */
.brand-icon {
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
