:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --accent: #00d4aa;
  --accent-dim: rgba(0, 212, 170, 0.12);
  --accent-glow: rgba(0, 212, 170, 0.25);
  --accent-hover: #00e8bb;
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --danger: #ff6b6b;
  --danger-dim: rgba(255, 107, 107, 0.12);
  --success: #00d4aa;
  --warning: #ffb347;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  line-height: 1.1;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===== NAV ===== */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  text-decoration: none;
}
.logo span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); }

.nav-btn {
  background: var(--accent) !important;
  color: var(--bg-primary) !important;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  transition: all 0.2s !important;
}
.nav-btn:hover {
  background: var(--accent-hover) !important;
  transform: translateY(-1px);
}

.nav-user-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

.nav-user {
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
}

.nav-logout {
  color: var(--text-muted) !important;
  font-size: 0.8rem !important;
}

/* ===== MAIN CONTENT ===== */
main {
  padding-top: 5rem;
  min-height: 100vh;
}

/* ===== LOADING ===== */
.loading-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== AUTH PAGES ===== */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 5rem);
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3rem 2.5rem;
}

.auth-card h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.auth-sub {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.auth-switch {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 1.5rem;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  min-height: 1.2rem;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: var(--accent);
  color: var(--bg-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  color: var(--bg-primary);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: transparent;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  background: var(--danger-dim);
  color: var(--danger);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 107, 107, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.2);
}

.btn-sm {
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  width: auto;
}

/* ===== DASHBOARD ===== */
.dashboard-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

.dashboard-header {
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  font-size: 1.75rem;
  margin-bottom: 0.35rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
}

.dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.dash-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.plan-highlight {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
}

.plan-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

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

.meta-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.card-actions {
  display: flex;
  gap: 0.75rem;
}

.card-actions .btn-primary,
.card-actions .btn-secondary {
  flex: 1;
  text-align: center;
}

.no-subscription {
  text-align: center;
  padding: 1rem 0;
}

.no-subscription p {
  margin-bottom: 0.5rem;
}

.no-subscription .btn-primary {
  margin-top: 1rem;
}

/* Active ride banner */
.active-ride-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--accent-dim);
  border: 1px solid rgba(0, 212, 170, 0.2);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.active-ride-banner:hover {
  background: rgba(0, 212, 170, 0.18);
}

.ride-pulse {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 8px transparent; }
}

.active-ride-banner strong {
  display: block;
  font-size: 0.9rem;
}

.active-ride-banner span {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.banner-arrow {
  margin-left: auto;
  font-size: 1.2rem;
  color: var(--accent);
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-badge.active, .status-badge.completed {
  background: var(--accent-dim);
  color: var(--accent);
}

.status-badge.requested, .status-badge.matching, .status-badge.driver_assigned, .status-badge.en_route, .status-badge.in_progress {
  background: rgba(255, 179, 71, 0.12);
  color: var(--warning);
}

.status-badge.cancelled {
  background: var(--danger-dim);
  color: var(--danger);
}

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-link { color: var(--accent); font-size: 0.85rem; font-weight: 500; }

/* ===== RIDES LIST ===== */
.rides-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ride-item {
  padding: 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.ride-item:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.02);
}

.ride-route {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
}

.ride-from { color: var(--text-primary); font-weight: 500; }
.ride-arrow { color: var(--text-muted); font-size: 0.75rem; }
.ride-to { color: var(--text-secondary); }

.ride-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ride-date {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.empty-state p { margin-bottom: 0.25rem; }

/* ===== PLANS PAGE ===== */
.plans-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.plans-header {
  text-align: center;
  margin-bottom: 3rem;
}

.plans-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -1px;
  margin-bottom: 0.75rem;
}

.section-label {
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.plan-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
}

.plan-card.featured {
  border-color: var(--accent);
  background: linear-gradient(170deg, var(--bg-card) 0%, rgba(0, 212, 170, 0.06) 100%);
}

.plan-card.featured::before {
  content: 'MOST POPULAR';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.3rem 1rem;
  border-radius: 100px;
}

.plan-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.plan-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.plan-price {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.plan-price span {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.plan-rides {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
  margin-bottom: 1.5rem;
}

.plan-features li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  padding-left: 1.25rem;
  position: relative;
}

.plan-features li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.plan-subscribe-btn {
  margin-top: auto;
}

/* ===== BOOKING PAGE ===== */
.booking-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem;
}

.booking-page h1 {
  font-size: 1.75rem;
  margin-bottom: 0.35rem;
}

.booking-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-top: 1.5rem;
}

.route-inputs {
  position: relative;
}

.route-connector {
  position: absolute;
  left: 1.15rem;
  top: 3.5rem;
  width: 2px;
  height: 2rem;
  background: var(--border);
}

.route-dot {
  position: absolute;
  left: 0.75rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid;
}

.route-dot.pickup {
  top: 0.85rem;
  border-color: var(--accent);
  background: var(--accent-dim);
}

.route-dot.dropoff {
  top: 6.35rem;
  border-color: var(--danger);
  background: var(--danger-dim);
}

.route-inputs .form-group input {
  padding-left: 2.5rem;
}

.booking-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.5rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}

.booking-meta-item {
  text-align: center;
}

.booking-meta-value {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
}

.booking-meta-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sub-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--accent-dim);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.sub-info-bar strong { color: var(--accent); }

/* ===== RIDE STATUS PAGE ===== */
.ride-status-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem;
}

.ride-status-page h1 {
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

.status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-top: 1.5rem;
}

.status-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  position: relative;
}

.status-progress::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 5%;
  right: 5%;
  height: 2px;
  background: var(--border);
}

.status-progress::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 5%;
  height: 2px;
  background: var(--accent);
  transition: width 0.5s ease;
}

.status-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  flex: 1;
}

.status-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  margin-bottom: 0.5rem;
  transition: all 0.3s;
}

.status-dot.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.status-dot.done {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg-primary);
}

.status-step-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 70px;
}

.status-step.active .status-step-label {
  color: var(--accent);
  font-weight: 600;
}

.current-status {
  text-align: center;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.current-status-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.current-status-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.driver-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.driver-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
}

.driver-info h4 {
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.driver-info p {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.driver-rating {
  margin-left: auto;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--warning);
}

.ride-route-display {
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.ride-route-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.ride-route-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ride-route-dot.pickup { background: var(--accent); }
.ride-route-dot.dropoff { background: var(--danger); }

.ride-route-divider {
  width: 2px;
  height: 20px;
  background: var(--border);
  margin-left: 4px;
}

.ride-route-address {
  font-size: 0.9rem;
}

.status-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ===== RIDES HISTORY PAGE ===== */
.rides-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem;
}

.rides-page h1 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

.rides-full-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ride-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.ride-history-item:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.ride-history-left {
  flex: 1;
}

.ride-history-route {
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.ride-history-details {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ride-history-right {
  text-align: right;
  margin-left: 1rem;
}

/* ===== SUCCESS PAGE ===== */
.success-page {
  max-width: 500px;
  margin: 0 auto;
  padding: 3rem 2rem;
  text-align: center;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 1.5rem;
}

.success-page h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.success-page .btn-primary {
  margin-top: 2rem;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== ERROR / 404 ===== */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem;
}

.error-page h1 {
  font-size: 4rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.error-page p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  nav { padding: 0.85rem 1.25rem; }
  .logo { font-size: 1.2rem; }
  .nav-links { gap: 0.75rem; }
  .nav-links a { font-size: 0.8rem; }
  .nav-user-section { display: none; }

  .dashboard-grid { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
  .plan-meta { grid-template-columns: repeat(3, 1fr); }
  .booking-meta { grid-template-columns: repeat(3, 1fr); }

  .auth-card { padding: 2rem 1.5rem; }
  .booking-page, .ride-status-page, .rides-page, .dashboard-page {
    padding: 1.5rem 1rem;
  }

  .status-step-label { font-size: 0.55rem; max-width: 50px; }
  .status-dot { width: 24px; height: 24px; font-size: 0.55rem; }
}

@media (max-width: 480px) {
  .nav-btn { padding: 0.4rem 0.85rem; font-size: 0.78rem !important; }
  .card-actions { flex-direction: column; }
}
