/* style.css */

/* 1. CSS CUSTOM PROPERTIES & THEME TOKENS */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Poppins', sans-serif;

  /* Color Palette */
  --bg-primary: #090D16;
  --bg-secondary: #0F172A;
  --bg-tertiary: #1E293B;
  --bg-glass: rgba(15, 23, 42, 0.6);
  --border-glass: rgba(255, 255, 255, 0.06);
  
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dark: #0F172A;
  
  --accent-emerald: #10B981;
  --accent-emerald-opaque: rgba(16, 185, 129, 0.12);
  --accent-blue: #3B82F6;
  --accent-blue-opaque: rgba(59, 130, 246, 0.12);
  --accent-amber: #F59E0B;
  --accent-amber-opaque: rgba(245, 158, 11, 0.12);
  --accent-red: #EF4444;
  --accent-red-opaque: rgba(239, 68, 68, 0.12);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-inset: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);

  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
  --border-radius-sm: 6px;
}

/* 2. BASE RESET & BODY STYLING */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Helper Utilities */
.hidden {
  display: none !important;
}

/* 3. BUTTONS & INPUTS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background-color: var(--accent-blue);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: #2563EB;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border-color: var(--border-glass);
}

.btn-secondary:hover {
  background-color: #334155;
}

.btn-danger {
  background-color: var(--accent-red-opaque);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background-color: var(--accent-red);
  color: #FFFFFF;
}

.btn-success {
  background-color: var(--accent-emerald-opaque);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  background-color: var(--accent-emerald);
  color: #FFFFFF;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--border-radius-sm);
  background-color: transparent;
  border: none;
  color: var(--text-muted);
}

.btn-icon:hover {
  color: var(--text-main);
  background-color: var(--bg-tertiary);
}

/* Inputs styling */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

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

.input-wrapper i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}

.input-wrapper input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Error banners */
.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background-color: var(--accent-red-opaque);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--border-radius-md);
  color: var(--accent-red);
  font-size: 14px;
  margin-bottom: 20px;
}

.error-banner i {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

/* 4. LOGIN SCREEN */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 40%),
              radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05), transparent 40%),
              var(--bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  background-color: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

.logo-area {
  text-align: center;
  margin-bottom: 30px;
}

.logo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--border-radius-md);
  background: linear-gradient(135deg, var(--accent-blue), #2563EB);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 16px;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.logo-area h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.logo-area p {
  font-size: 13px;
  color: var(--text-muted);
}

/* 5. DASHBOARD LAYOUT & SIDEBAR */
.dashboard-wrapper {
  display: flex;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.sidebar-logo span {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background-color: transparent;
  border: none;
  border-radius: var(--border-radius-md);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--accent-blue-opaque);
  color: var(--accent-blue);
  font-weight: 600;
}

.nav-item i {
  width: 18px;
  height: 18px;
}

.pill-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background-color: var(--accent-amber);
  color: var(--text-dark);
  padding: 2px 6px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent-blue);
  border: 1px solid var(--border-glass);
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  justify-content: flex-start;
}

.btn-logout:hover {
  color: var(--accent-red);
  background-color: var(--accent-red-opaque);
}

/* 6. MAIN CONTENT AREA */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 32px;
  background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.02), transparent 40%),
              var(--bg-primary);
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.header-title h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.header-title p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.stat-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon i {
  width: 22px;
  height: 22px;
}

.icon-blue {
  background-color: var(--accent-blue-opaque);
  color: var(--accent-blue);
}

.icon-amber {
  background-color: var(--accent-amber-opaque);
  color: var(--accent-amber);
}

.icon-emerald {
  background-color: var(--accent-emerald-opaque);
  color: var(--accent-emerald);
}

.stat-info h3 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 2px;
}

.stat-info p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Toolbar & Filtering */
.toolbar {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 400px;
}

.search-box i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}

.search-box input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* 7. RIDERS TABLE */
.table-container {
  flex-grow: 1;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

.riders-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.riders-table th {
  background-color: rgba(255, 255, 255, 0.01);
  padding: 16px 20px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-glass);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 2;
}

.riders-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-glass);
  vertical-align: middle;
}

.riders-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

/* Table elements */
.rider-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rider-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-glass);
}

.rider-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent-blue);
  border: 1px solid var(--border-glass);
  font-size: 13px;
}

.rider-meta {
  display: flex;
  flex-direction: column;
}

.rider-name {
  font-weight: 600;
  color: var(--text-main);
}

.rider-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

.rider-contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.contact-item i {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.status-green {
  background-color: var(--accent-emerald-opaque);
  color: var(--accent-emerald);
}

.status-amber {
  background-color: var(--accent-amber-opaque);
  color: var(--accent-amber);
}

.status-gray {
  background-color: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

.vehicle-info {
  display: flex;
  flex-direction: column;
}

.vehicle-label {
  font-weight: 500;
  text-transform: capitalize;
}

.ev-badge {
  font-size: 9px;
  font-weight: 700;
  background-color: #10B981;
  color: #000;
  padding: 1px 4px;
  border-radius: 3px;
  width: fit-content;
  margin-top: 2px;
  letter-spacing: 0.5px;
}

/* Placeholders & Spinners */
.table-placeholder {
  text-align: center;
  padding: 60px 0 !important;
}

.table-placeholder p {
  color: var(--text-muted);
  margin-top: 16px;
  font-size: 14px;
}

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  border-top-color: var(--accent-blue);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.action-cell {
  text-align: right;
}

.action-row-buttons {
  display: inline-flex;
  gap: 6px;
}

.action-row-buttons .btn {
  padding: 6px 12px;
  font-size: 12px;
}

/* 8. RIDER DETAIL MODAL */
.modal-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
  padding: 40px;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 900px;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.btn-close {
  background-color: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-close:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

/* Rider Modal Header card */
.rider-profile-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  padding: 16px 20px;
  border-radius: var(--border-radius-md);
  margin-bottom: 24px;
}

.summary-avatar-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.modal-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-blue);
  background-color: var(--bg-tertiary);
}

.summary-text h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.summary-payout {
  font-size: 13px;
  color: var(--text-muted);
}

.summary-payout strong {
  color: var(--text-main);
  text-transform: capitalize;
}

/* Grid splits inside modal */
.modal-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.details-section h4, .documents-section h4 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 16px;
  letter-spacing: 0.3px;
}

.info-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 14px;
  font-weight: 500;
}

.section-divider {
  border: 0;
  height: 1px;
  background-color: var(--border-glass);
  margin: 18px 0;
}

/* Document cards inside modal */
.documents-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.doc-card {
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  background-color: rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.doc-meta {
  padding: 8px 12px;
  background-color: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-glass);
  font-size: 12px;
  font-weight: 600;
}

.doc-preview {
  height: 160px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #030712;
}

.doc-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.doc-preview img:hover {
  transform: scale(1.05);
}

.image-fallback {
  display: none;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

/* Show fallback when image is missing */
.doc-preview.no-image img {
  display: none;
}

.doc-preview.no-image .image-fallback {
  display: block;
}

/* Modal Footer */
.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.01);
  flex-shrink: 0;
}

.modal-status-label {
  font-size: 13px;
  color: var(--text-muted);
}

.modal-status-label strong {
  text-transform: capitalize;
}

.modal-footer-actions {
  display: inline-flex;
  gap: 10px;
}
