/* ===== RideX Global Styles ===== */
:root {
  --primary: #1A56DB;
  --primary-dark: #0E3DA8;
  --primary-light: #EBF0FD;
  --green: #057A55;
  --green-light: #DEF7EC;
  --orange: #C27803;
  --orange-light: #FDF3C1;
  --red: #C81E1E;
  --red-light: #FDE8E8;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== Typography ===== */
h1,h2,h3,h4,h5 { font-weight: 600; line-height: 1.3; color: var(--gray-900); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
p  { color: var(--gray-600); }
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.container { max-width: 480px; margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== Cards ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 16px; }
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  line-height: 1;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success  { background: var(--green); color: var(--white); }
.btn-success:hover:not(:disabled) { background: #046148; }
.btn-danger   { background: var(--red); color: var(--white); }
.btn-danger:hover:not(:disabled)  { background: #9B1C1C; }
.btn-outline  { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary-light); }
.btn-gray     { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-gray:hover:not(:disabled)    { background: var(--gray-200); }
.btn-full     { width: 100%; }
.btn-sm       { padding: 7px 12px; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.btn-lg       { padding: 14px 24px; font-size: 1rem; border-radius: var(--radius); }
.btn-icon     { width: 38px; height: 38px; padding: 0; border-radius: 50%; }

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--gray-700); margin-bottom: 5px; }
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
.form-control::placeholder { color: var(--gray-400); }
.form-control.error { border-color: var(--red); }

select.form-control { cursor: pointer; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-primary  { background: var(--primary-light);  color: var(--primary-dark); }
.badge-success  { background: var(--green-light);    color: var(--green); }
.badge-warning  { background: var(--orange-light);   color: var(--orange); }
.badge-danger   { background: var(--red-light);      color: var(--red); }
.badge-gray     { background: var(--gray-100);       color: var(--gray-600); }

/* ===== Alerts ===== */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-danger  { background: var(--red-light);    color: var(--red); border: 1px solid #FCA5A5; }
.alert-success { background: var(--green-light);  color: var(--green); border: 1px solid #6EE7B7; }
.alert-warning { background: var(--orange-light); color: var(--orange); border: 1px solid #FDE68A; }
.alert-info    { background: var(--primary-light);color: var(--primary-dark); border: 1px solid #A5B4FC; }

/* ===== Navbar ===== */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.navbar-brand {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar-brand span { color: var(--gray-800); }
.navbar-actions { display: flex; align-items: center; gap: 8px; }

/* ===== Bottom Nav (mobile) ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px 8px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--gray-400);
  font-size: 0.6875rem;
  font-weight: 500;
  gap: 3px;
  transition: color 0.15s;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item svg   { width: 22px; height: 22px; }

/* ===== Page system ===== */
.page { display: none; padding-bottom: 80px; }
.page.active { display: block; }

/* ===== Map Placeholder ===== */
.map-container {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #E8F4FD 0%, #EAF3E8 100%);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
}
.map-container iframe { width: 100%; height: 100%; border: 0; border-radius: var(--radius); }
.map-placeholder {
  text-align: center;
  color: var(--gray-500);
  font-size: 0.875rem;
}
.map-placeholder .map-icon { font-size: 2.5rem; margin-bottom: 6px; }

/* ===== Ride Type Cards ===== */
.ride-types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ride-type-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  background: var(--white);
}
.ride-type-card:hover  { border-color: var(--primary); background: var(--primary-light); }
.ride-type-card.active { border-color: var(--primary); background: var(--primary-light); }
.ride-type-card .icon  { font-size: 2rem; margin-bottom: 4px; }
.ride-type-card .name  { font-size: 0.9375rem; font-weight: 600; color: var(--gray-800); }
.ride-type-card .price { font-size: 0.8125rem; color: var(--primary); font-weight: 500; margin-top: 2px; }
.ride-type-card .eta   { font-size: 0.75rem; color: var(--green); margin-top: 2px; }

/* ===== Status Timeline ===== */
.status-timeline { padding: 12px 0; }
.status-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}
.status-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  width: 2px;
  height: calc(100% - 8px);
  background: var(--gray-200);
}
.status-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
  background: var(--gray-100);
  color: var(--gray-400);
  border: 2px solid var(--gray-200);
}
.status-dot.done    { background: var(--green-light); color: var(--green); border-color: var(--green); }
.status-dot.active  { background: var(--primary-light); color: var(--primary); border-color: var(--primary); animation: pulseBorder 1.5s ease-in-out infinite; }
.status-label       { font-size: 0.9rem; font-weight: 500; color: var(--gray-700); }
.status-sub         { font-size: 0.8rem; color: var(--gray-500); }

@keyframes pulseBorder {
  0%,100% { box-shadow: 0 0 0 0 rgba(26,86,219,0.3); }
  50%      { box-shadow: 0 0 0 6px rgba(26,86,219,0); }
}

/* ===== Driver Card ===== */
.driver-card-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.driver-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
  overflow: hidden;
}
.driver-avatar img { width: 100%; height: 100%; object-fit: cover; }
.driver-info { flex: 1; min-width: 0; }
.driver-name { font-weight: 600; color: var(--gray-800); font-size: 0.9375rem; }
.driver-meta { font-size: 0.8125rem; color: var(--gray-500); margin-top: 1px; }
.stars { color: #F59E0B; font-size: 0.8rem; }

/* ===== Ride History Item ===== */
.ride-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.ride-item:last-child { border-bottom: none; }
.ride-item-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.ride-item-details { flex: 1; min-width: 0; }
.ride-item-route   { font-size: 0.875rem; font-weight: 500; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ride-item-meta    { font-size: 0.8rem; color: var(--gray-500); margin-top: 2px; }
.ride-item-fare    { font-size: 0.9375rem; font-weight: 600; color: var(--gray-800); text-align: right; }

/* ===== Stat Cards ===== */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card  {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-value { font-size: 1.375rem; font-weight: 700; color: var(--gray-900); }
.stat-label { font-size: 0.75rem; color: var(--gray-500); margin-top: 2px; }
.stat-value.green  { color: var(--green); }
.stat-value.blue   { color: var(--primary); }
.stat-value.orange { color: var(--orange); }

/* ===== Toggle Switch ===== */
.toggle-switch { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.toggle-label  { font-size: 0.9375rem; font-weight: 500; }
.toggle-sub    { font-size: 0.8rem; color: var(--gray-500); margin-top: 1px; }
.switch        { position: relative; width: 48px; height: 26px; flex-shrink: 0; }
.switch input  { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0;
  background: var(--gray-300);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}
input:checked + .switch-slider { background: var(--green); }
input:checked + .switch-slider::before { transform: translateX(22px); }

/* ===== OTP Input ===== */
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
.otp-input  {
  width: 52px; height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--gray-900);
  outline: none;
  transition: border-color 0.15s;
}
.otp-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }

/* ===== Loading Spinner ===== */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  backdrop-filter: blur(2px);
}
.loading-overlay p { font-size: 0.9375rem; color: var(--gray-600); }

/* ===== Divider ===== */
.divider { height: 1px; background: var(--gray-100); margin: 12px 0; }
.divider-text {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0;
  font-size: 0.8125rem;
  color: var(--gray-400);
}
.divider-text::before,.divider-text::after {
  content: ''; flex: 1;
  height: 1px; background: var(--gray-200);
}

/* ===== Fare Row ===== */
.fare-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--gray-100);
}
.fare-row:last-child { border-bottom: none; font-weight: 600; }
.fare-row .label { color: var(--gray-600); }
.fare-row .value { font-weight: 500; color: var(--gray-800); }
.fare-row .value.green { color: var(--green); }
.fare-row .value.red   { color: var(--red); }

/* ===== Auth page ===== */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, #0E3DA8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}
.auth-logo .logo-mark {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 2rem;
}
.auth-logo h1 { font-size: 1.5rem; color: var(--gray-900); }
.auth-logo p  { font-size: 0.875rem; color: var(--gray-500); margin-top: 4px; }
.auth-tabs { display: flex; gap: 0; background: var(--gray-100); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 20px; }
.auth-tab  {
  flex: 1; padding: 8px; text-align: center;
  font-size: 0.875rem; font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--gray-500);
  transition: all 0.15s;
}
.auth-tab.active { background: var(--white); color: var(--primary); box-shadow: var(--shadow-sm); }

/* ===== Admin Layout ===== */
.admin-layout   { display: flex; min-height: 100vh; }
.admin-sidebar  {
  width: 240px;
  background: var(--gray-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 200;
}
.admin-sidebar-brand {
  padding: 20px 16px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.admin-sidebar-brand span { color: #60A5FA; }
.admin-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
  border-radius: 0;
}
.admin-nav-item:hover  { background: rgba(255,255,255,0.07); color: var(--white); }
.admin-nav-item.active { background: var(--primary); color: var(--white); }
.admin-nav-item svg    { width: 18px; height: 18px; flex-shrink: 0; }
.admin-content { margin-left: 240px; flex: 1; padding: 24px; background: var(--gray-50); min-height: 100vh; }
.admin-header  { margin-bottom: 24px; }
.admin-header h1 { font-size: 1.375rem; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.admin-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 500;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--gray-50); }

/* ===== Pulse dot ===== */
.pulse-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulseDot 1.5s ease-in-out infinite;
}
@keyframes pulseDot {
  0%,100% { opacity:1; transform: scale(1); }
  50%      { opacity:0.5; transform: scale(0.7); }
}

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 10px; }
.empty-state h3    { font-size: 1rem; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p     { font-size: 0.875rem; }

/* ===== Utility ===== */
.mt-1{margin-top:4px}   .mt-2{margin-top:8px}   .mt-3{margin-top:12px}  .mt-4{margin-top:16px}  .mt-5{margin-top:20px}
.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px} .mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-5{margin-bottom:20px}
.p-3{padding:12px} .p-4{padding:16px}
.d-flex{display:flex} .align-center{align-items:center} .justify-between{justify-content:space-between}
.gap-2{gap:8px} .gap-3{gap:12px}
.text-sm{font-size:0.875rem} .text-xs{font-size:0.75rem}
.text-muted{color:var(--gray-500)} .text-success{color:var(--green)} .text-danger{color:var(--red)} .text-primary{color:var(--primary)}
.fw-600{font-weight:600} .fw-700{font-weight:700}
.w-100{width:100%} .text-center{text-align:center}
.hidden{display:none!important}

/* ===== Responsive ===== */
@media(max-width:768px){
  .admin-sidebar  { transform: translateX(-100%); transition: transform 0.25s; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-content  { margin-left: 0; padding: 16px; }
}
