/* ===== SHARED STYLES - RideNow Car Hire Platform ===== */

:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #ebf5ff;
  --secondary: #f59e0b;
  --secondary-dark: #d97706;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --info: #06b6d4;
  --info-light: #cffafe;
  --dark: #111827;
  --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: #f9fafb;
  --white: #ffffff;
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --transition: all 0.2s ease;
  --page-max-width: 1840px;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  font-size: 14px;
  overflow-x: hidden;
  max-width: 100%;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== LAYOUT ===== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.sidebar-logo .logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

.sidebar-logo .logo-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 4px;
}

/* Panel sidebar brand wordmark (admin / passenger / driver) */
.panel-brand-logo {
  height: 30px;
  width: auto;
  max-width: min(178px, 100%);
  display: block;
  object-fit: contain;
  object-position: left center;
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-logo .panel-sidebar-badge {
  margin-left: 0;
  flex-shrink: 0;
  align-self: center;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-user .user-info .name {
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-900);
}

.sidebar-user .user-info .role {
  font-size: 11px;
  color: var(--gray-500);
}

.sidebar-nav {
  padding: 12px 0;
  /* Do not flex-grow: a short menu left a huge gap above Logout pinned at the bottom of 100vh sidebars. */
  flex: 0 1 auto;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-400);
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 500;
  border-radius: 0;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  margin: 1px 8px;
  border-radius: 8px;
}

.nav-item:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  display: none;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 15px;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
}

.sidebar-footer .btn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: var(--transition);
  width: 100%;
}

.sidebar-footer .btn-logout:hover {
  background: var(--danger-light);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  min-width: 0;
  gap: 8px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.topbar-left > div {
  min-width: 0;
}

.topbar-left .page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-left .breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--gray-100);
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border: none;
}

.topbar-icon-btn:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.topbar-icon-btn .notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
}

/* ===== PAGE CONTENT ===== */
.page-content {
  padding: 28px;
  flex: 1;
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  min-width: 0;
}

.page-section,
.card,
.card-body {
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px 16px;
  min-width: 0;
}

.page-header > div:last-child {
  min-width: 0;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
}

.page-header p {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  min-width: 0;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}

.card-body {
  padding: 20px;
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-card .stat-info .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.stat-card .stat-info .label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}

.stat-card .stat-info .change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

.stat-card .stat-info .change.up { color: var(--success); }
.stat-card .stat-info .change.down { color: var(--danger); }

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon.cyan { background: var(--info-light); color: var(--info); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-200); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #059669; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-warning {
  background: var(--warning);
  color: white;
}
.btn-warning:hover { background: var(--secondary-dark); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 10px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
}

/* ===== TABLES ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--gray-50);
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  color: var(--gray-700);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--gray-50);
}

/* ===== BADGES / TAGS ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info { background: var(--info-light); color: #164e63; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-purple { background: #f5f3ff; color: #5b21b6; }

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 13px;
  color: var(--gray-800);
  background: var(--white);
  transition: var(--transition);
  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-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.input-group {
  display: flex;
  align-items: center;
  position: relative;
}

.input-group .input-icon {
  position: absolute;
  left: 12px;
  color: var(--gray-400);
  font-size: 14px;
}

.input-group .form-control {
  padding-left: 38px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.mobile-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 95;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.mobile-sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  color: var(--gray-500);
  background: none;
  border: none;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  min-width: 0;
}

.tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  flex-shrink: 0;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-success { background: var(--success-light); color: #065f46; }
.alert-danger { background: var(--danger-light); color: #991b1b; }
.alert-warning { background: var(--warning-light); color: #92400e; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); }

/* ===== SEARCH / FILTER BAR ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 14px;
}

.search-box input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
}

.page-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-600);
  transition: var(--transition);
}

.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ===== MAP PLACEHOLDER ===== */
.map-placeholder {
  background: linear-gradient(135deg, #e8f4fd, #d1e9f6);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.map-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234299e1' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.map-placeholder .map-label {
  text-align: center;
  z-index: 1;
}

.map-placeholder .map-label i {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 12px;
  display: block;
}

.map-placeholder .map-label p {
  font-size: 14px;
  color: var(--gray-600);
  font-weight: 500;
}

/* ===== AVATAR ===== */
.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.avatar-md {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.avatar-xl {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
}

/* Rating stars */
.stars {
  display: inline-flex;
  gap: 2px;
  color: var(--warning);
  font-size: 13px;
}

/* ===== TIMELINE ===== */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -23px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item:last-child { padding-bottom: 0; }

/* ===== RIDE CARD ===== */
.ride-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 16px;
  transition: var(--transition);
}

.ride-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
}

/* ===== TOAST NOTIFICATION ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  min-width: 280px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ===== RESPONSIVE ===== */
@media (min-width: 1536px) {
  :root {
    --page-max-width: 1920px;
  }

  .page-content {
    padding: 32px;
  }

  .topbar {
    padding: 0 32px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
  }

  .grid-2,
  .grid-3 {
    gap: 18px;
  }
}

/* Keep long forms compact on large screens while preserving mobile full width. */
@media (min-width: 1200px) {
  .form-control,
  .form-select,
  textarea.form-control {
    max-width: 760px;
  }

  .form-row .form-control,
  .form-row .form-select,
  .input-group .form-control {
    max-width: 100%;
  }

  .card-body > form,
  .booking-form-card {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 2200px) {
  :root {
    --page-max-width: 2100px;
  }

  .page-content {
    padding: 36px 40px;
  }

  .card-header,
  .card-body {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 1280px) {
  .page-content {
    padding: 22px;
  }

  .topbar {
    padding: 0 20px;
  }

  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .page-content {
    padding: 18px;
  }

  .topbar-left .page-title {
    font-size: 16px;
  }

  .topbar-right {
    gap: 10px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .card-header {
    gap: 10px;
    flex-wrap: wrap;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-footer {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: min(var(--sidebar-width), calc(100vw - 46px));
    max-width: calc(100vw - 46px);
  }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar {
    padding: 0 14px;
    gap: 10px;
  }
  .topbar-left {
    min-width: 0;
    gap: 10px;
  }
  .topbar-left .page-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 48vw;
  }
  .topbar-right {
    gap: 8px;
  }
  .topbar-right > * {
    flex-shrink: 0;
  }
  .btn {
    white-space: normal;
  }
  .table-container {
    margin: 0 -2px;
  }
  .filter-bar {
    gap: 8px;
  }
  .filter-bar .search-box,
  .filter-bar .form-control,
  .filter-bar .btn {
    width: 100% !important;
    min-width: 0;
  }
  .filter-bar .btn {
    justify-content: center;
  }
  /* Horizontal scroll only when the card body is a direct table host (avoids shrinking entire cards). */
  .card-body:has(> table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .card-body > table {
    min-width: 640px;
  }
  .page-content canvas {
    max-width: 100%;
  }
  .toast-container {
    left: 12px;
    right: 12px;
    top: 12px;
  }
  .toast {
    min-width: 0;
    width: 100%;
  }
}

/* Ride list rows: stack fare/actions on phones (admin, driver, passenger) */
@media (max-width: 767.98px) {
  .trip-item,
  .ride-row-mobile {
    flex-wrap: wrap;
    align-items: flex-start !important;
  }
  .trip-item-body,
  .ride-row-mobile__body {
    flex: 1 1 100%;
    min-width: 0;
  }
  .trip-item-fare,
  .ride-row-mobile__fare {
    flex-basis: 100%;
    margin-left: 58px;
    padding-top: 6px;
    text-align: left;
  }
  .ride-row-mobile__actions {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
  }
  .ride-row-mobile__actions .btn {
    flex: 1 1 auto;
    min-width: min(100%, 140px);
    justify-content: center;
  }
  #page-rides .table-container table {
    min-width: 0;
  }
  #page-rides .card-body > table {
    min-width: 720px;
  }
  .trip-request-card > div[style*="display:flex"] {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content {
    padding: 12px;
  }
  .topbar {
    height: 58px;
    padding: 0 10px;
  }
  .topbar-icon-btn {
    width: 34px;
    height: 34px;
  }
  .badge {
    font-size: 10px;
    padding: 2px 8px;
  }
  .card-header,
  .card-body,
  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }
  .modal {
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }
  .modal-footer {
    flex-wrap: wrap;
  }
  .modal-footer .btn {
    flex: 1 1 100%;
  }
}

/* ===== UTILITY ===== */
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-bold { font-weight: 700; }
.text-semibold { font-weight: 600; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.divider { height: 1px; background: var(--gray-200); margin: 16px 0; }
.hidden { display: none !important; }
