/**
 * ============================================================
 *  ZAPTOU DRIVER — Premium App Styles
 *  Mobile-first design for delivery drivers
 *  Reference: QuickServe-style food delivery driver app
 * ============================================================
 */

/* ── 0. DESIGN TOKENS ───────────────────────────────────── */
:root {
  --drv-primary: var(--z-primary, #ff5c00);
  --drv-primary-dark: #e54f00;
  --drv-primary-light: rgba(255, 92, 0, 0.08);
  --drv-primary-gradient: linear-gradient(135deg, #ff5c00 0%, #ff7a2e 100%);
  --drv-success: #10b981;
  --drv-error: #ef4444;
  --drv-warning: #f59e0b;
  --drv-text: #1a1a2e;
  --drv-text-secondary: #64748b;
  --drv-text-muted: #94a3b8;
  --drv-border: #e2e8f0;
  --drv-bg: #f8f9fa;
  --drv-surface: #ffffff;
  --drv-radius: 16px;
  --drv-radius-sm: 12px;
  --drv-radius-xs: 8px;
  --drv-radius-pill: 999px;
  --drv-shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --drv-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --drv-shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --drv-transition: all 0.2s ease;
}

/* ── 1. RESET & BASE ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--drv-text);
  background: var(--drv-bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; height: auto; display: block; }
.material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
  font-variation-settings: "wght" 420, "opsz" 24;
}

/* ── 2. APP SHELL ───────────────────────────────────────── */
.drv-app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--drv-bg);
  position: relative;
  overflow-x: hidden;
}

/* ── 3. SPLASH SCREEN ───────────────────────────────────── */
.drv-splash {
  min-height: 100vh;
  background: var(--drv-primary-gradient);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  padding: 40px 24px;
}

.drv-splash-logo {
  width: 120px;
  height: 120px;
  border-radius: 32px;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
  font-size: 3rem;
}

.drv-splash h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.drv-splash p {
  font-size: 1rem;
  opacity: 0.9;
  max-width: 280px;
}

.drv-splash-illustration {
  margin-top: 48px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drv-splash-illustration .material-symbols-outlined {
  font-size: 80px;
  color: rgba(255,255,255,0.8);
}

/* ── 4. LOGIN PAGE ──────────────────────────────────────── */
.drv-login {
  min-height: 100vh;
  background: var(--drv-bg);
  display: flex;
  flex-direction: column;
}

.drv-login-hero {
  background: var(--drv-primary-gradient);
  padding: 60px 24px 80px;
  text-align: center;
  color: #fff;
  border-radius: 0 0 32px 32px;
  position: relative;
}

.drv-login-hero .back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.drv-login-hero h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.drv-login-hero p {
  font-size: 0.9rem;
  opacity: 0.9;
}

.drv-login-illustration {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px auto 0;
}

.drv-login-illustration .material-symbols-outlined {
  font-size: 56px;
  color: rgba(255,255,255,0.9);
}

.drv-login-form-wrap {
  padding: 24px;
  margin-top: -40px;
  position: relative;
  z-index: 2;
}

.drv-login-card {
  background: var(--drv-surface);
  border-radius: var(--drv-radius);
  padding: 24px;
  box-shadow: var(--drv-shadow-lg);
}

.drv-login-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--drv-text-secondary);
  margin-bottom: 6px;
}

.drv-login-input {
  width: 100%;
  height: 48px;
  border: 1.5px solid var(--drv-border);
  border-radius: var(--drv-radius-sm);
  padding: 0 14px;
  font-size: 0.95rem;
  background: var(--drv-surface);
  color: var(--drv-text);
  margin-bottom: 14px;
  transition: var(--drv-transition);
}

.drv-login-input:focus {
  outline: none;
  border-color: var(--drv-primary);
  box-shadow: 0 0 0 3px var(--drv-primary-light);
}

.drv-login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 10px 14px;
  border-radius: var(--drv-radius-sm);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.drv-login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--drv-text-muted);
  font-size: 0.8rem;
}

.drv-login-divider::before,
.drv-login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--drv-border);
}

.drv-social-btns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.drv-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border: 1.5px solid var(--drv-border);
  border-radius: var(--drv-radius-sm);
  background: var(--drv-surface);
  cursor: pointer;
  transition: var(--drv-transition);
  font-size: 1.2rem;
}

.drv-social-btn:hover {
  border-color: var(--drv-primary);
  background: var(--drv-primary-light);
}

.drv-social-btn.fb { color: #1877f2; }
.drv-social-btn.google { color: #ea4335; }
.drv-social-btn.apple { color: #000; }

.drv-login-footer {
  text-align: center;
  padding: 16px 24px 32px;
  font-size: 0.85rem;
  color: var(--drv-text-secondary);
}

.drv-login-footer a {
  color: var(--drv-primary);
  font-weight: 600;
  text-decoration: none;
}

/* ── 5. BUTTONS ─────────────────────────────────────────── */
.drv-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: var(--drv-radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--drv-transition);
}

.drv-btn-primary {
  background: var(--drv-primary);
  color: #fff;
}

.drv-btn-primary:hover {
  background: var(--drv-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--drv-shadow-md);
}

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

.drv-btn-secondary {
  background: var(--drv-surface);
  color: var(--drv-text);
  border: 1.5px solid var(--drv-border);
}

.drv-btn-secondary:hover {
  border-color: var(--drv-primary);
}

.drv-btn-success {
  background: var(--drv-success);
  color: #fff;
}

.drv-btn-danger {
  background: var(--drv-error);
  color: #fff;
}

.drv-btn-sm {
  height: 40px;
  font-size: 0.85rem;
  border-radius: var(--drv-radius-sm);
}

.drv-btn-pill {
  border-radius: var(--drv-radius-pill);
}

/* ── 6. PAGE HEADER ─────────────────────────────────────── */
.drv-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--drv-surface);
  border-bottom: 1px solid var(--drv-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.drv-header .back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--drv-text);
}

.drv-header h1 {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
}

/* ── 7. STATUS BAR ──────────────────────────────────────── */
.drv-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--drv-surface);
  border-bottom: 1px solid var(--drv-border);
}

.drv-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.drv-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--drv-success);
  animation: pulse 2s infinite;
}

.drv-status-dot.offline {
  background: var(--drv-text-muted);
  animation: none;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.drv-online-toggle {
  width: 52px;
  height: 28px;
  border-radius: 14px;
  border: none;
  background: var(--drv-success);
  cursor: pointer;
  position: relative;
  transition: var(--drv-transition);
}

.drv-online-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: var(--drv-transition);
}

.drv-online-toggle.offline {
  background: var(--drv-text-muted);
}

.drv-online-toggle.offline::after {
  transform: translateX(24px);
}

/* ── 8. MAP ─────────────────────────────────────────────── */
.drv-map-container {
  position: relative;
  height: calc(100vh - 200px);
  min-height: 400px;
}

.drv-map {
  width: 100%;
  height: 100%;
  background: var(--drv-bg);
}

/* ── 9. ORDER CARD ──────────────────────────────────────── */
.drv-order-card {
  background: var(--drv-surface);
  border-radius: var(--drv-radius);
  padding: 20px;
  margin: 12px 16px;
  box-shadow: var(--drv-shadow-sm);
  border: 1px solid var(--drv-border);
}

.drv-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.drv-order-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--drv-text);
}

.drv-order-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--drv-radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
}

.drv-order-status.active { background: #dcfce7; color: #16a34a; }
.drv-order-status.pending { background: #fef3c7; color: #d97706; }
.drv-order-status.completed { background: #f3f4f6; color: #6b7280; }

.drv-order-info {
  display: grid;
  gap: 12px;
}

.drv-order-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.85rem;
}

.drv-order-row .icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--drv-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drv-order-row .icon .material-symbols-outlined {
  font-size: 16px;
  color: var(--drv-primary);
}

.drv-order-row .label {
  font-size: 0.75rem;
  color: var(--drv-text-muted);
  margin-bottom: 2px;
}

.drv-order-row .value {
  font-weight: 600;
  color: var(--drv-text);
}

/* ── 10. NEW ORDER REQUEST ──────────────────────────────── */
.drv-new-order {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--drv-surface);
  border-radius: var(--drv-radius) var(--drv-radius) 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.drv-new-order.show {
  transform: translateY(0);
}

.drv-new-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--drv-border);
}

.drv-new-order-title {
  font-size: 1rem;
  font-weight: 700;
}

.drv-new-order-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--drv-primary);
}

.drv-new-order-body {
  padding: 16px 20px;
}

.drv-new-order-route {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.drv-route-point {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drv-route-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--drv-primary);
}

.drv-route-dot.dest {
  background: var(--drv-success);
}

.drv-route-line {
  flex: 1;
  height: 2px;
  background: var(--drv-border);
  position: relative;
}

.drv-route-line::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--drv-primary) 0, var(--drv-primary) 4px, transparent 4px, transparent 8px);
  transform: translateY(-50%);
}

.drv-new-order-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.drv-stat-card {
  background: var(--drv-bg);
  border-radius: var(--drv-radius-sm);
  padding: 12px;
  text-align: center;
}

.drv-stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--drv-text);
}

.drv-stat-label {
  font-size: 0.75rem;
  color: var(--drv-text-muted);
  margin-top: 2px;
}

.drv-new-order-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── 11. EARNINGS ───────────────────────────────────────── */
.drv-earnings-header {
  background: var(--drv-surface);
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid var(--drv-border);
}

.drv-earnings-amount {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--drv-text);
  margin-bottom: 4px;
}

.drv-earnings-period {
  font-size: 0.85rem;
  color: var(--drv-text-muted);
}

.drv-earnings-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 20px;
}

.drv-stat-item {
  text-align: center;
}

.drv-stat-item .value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--drv-text);
}

.drv-stat-item .label {
  font-size: 0.75rem;
  color: var(--drv-text-muted);
  margin-top: 2px;
}

/* ── 12. PROFILE ────────────────────────────────────────── */
.drv-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 20px;
  background: var(--drv-surface);
  border-bottom: 1px solid var(--drv-border);
}

.drv-profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--drv-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.drv-profile-avatar .material-symbols-outlined {
  font-size: 36px;
  color: var(--drv-primary);
}

.drv-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drv-profile-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.drv-profile-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--drv-warning);
  font-weight: 600;
}

.drv-profile-menu {
  padding: 0 20px;
}

.drv-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--drv-border);
  text-decoration: none;
  color: var(--drv-text);
  transition: var(--drv-transition);
}

.drv-menu-item:last-child { border-bottom: none; }

.drv-menu-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--drv-radius-sm);
  background: var(--drv-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drv-menu-icon .material-symbols-outlined {
  font-size: 20px;
  color: var(--drv-primary);
}

.drv-menu-text {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
}

.drv-menu-arrow {
  color: var(--drv-text-muted);
}

/* ── 13. BOTTOM NAV ─────────────────────────────────────── */
.drv-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 64px;
  background: var(--drv-surface);
  border-top: 1px solid var(--drv-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.drv-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--drv-text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 8px 12px;
  text-decoration: none;
}

.drv-nav-item.active {
  color: var(--drv-primary);
}

.drv-nav-item .material-symbols-outlined {
  font-size: 24px;
}

/* ── 14. CHECKLIST ──────────────────────────────────────── */
.drv-checklist {
  padding: 20px;
}

.drv-checklist-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--drv-surface);
  border-radius: var(--drv-radius-sm);
  margin-bottom: 10px;
  border: 1px solid var(--drv-border);
}

.drv-checklist-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--drv-success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.drv-checklist-icon.pending {
  background: var(--drv-text-muted);
}

.drv-checklist-text {
  flex: 1;
}

.drv-checklist-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.drv-checklist-desc {
  font-size: 0.75rem;
  color: var(--drv-text-muted);
}

/* ── 15. NOTIFICATIONS ──────────────────────────────────── */
.drv-notification {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--drv-border);
}

.drv-notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drv-notification-icon.order { background: #dcfce7; color: #16a34a; }
.drv-notification-icon.payment { background: #fef3c7; color: #d97706; }
.drv-notification-icon.system { background: #eff6ff; color: #3b82f6; }

.drv-notification-text {
  flex: 1;
}

.drv-notification-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.drv-notification-desc {
  font-size: 0.78rem;
  color: var(--drv-text-muted);
}

.drv-notification-time {
  font-size: 0.7rem;
  color: var(--drv-text-muted);
}

/* ── 16. TOAST ──────────────────────────────────────────── */
.drv-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--drv-text);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--drv-radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--drv-shadow-lg);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.drv-toast.show { opacity: 1; }

/* ── 17. LOADING ────────────────────────────────────────── */
.drv-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--drv-text-muted);
}

.drv-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--drv-border);
  border-top-color: var(--drv-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

/* ── 18. EMPTY STATES ───────────────────────────────────── */
.drv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--drv-text-muted);
}

.drv-empty .material-symbols-outlined {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.drv-empty h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--drv-text);
  margin-bottom: 8px;
}

.drv-empty p {
  font-size: 0.85rem;
}

/* ── 19. RESPONSIVE ─────────────────────────────────────── */
@media (min-width: 769px) {
  .drv-app {
    max-width: 100%;
  }
  
  .drv-bottom-nav {
    max-width: 100%;
  }
}

/* ── 20. UTILITIES ──────────────────────────────────────── */
.drv-hidden { display: none !important; }
.drv-text-center { text-align: center; }
.drv-mt-1 { margin-top: 8px; }
.drv-mt-2 { margin-top: 16px; }
.drv-mt-3 { margin-top: 24px; }
.drv-mb-1 { margin-bottom: 8px; }
.drv-mb-2 { margin-bottom: 16px; }
.drv-mb-3 { margin-bottom: 24px; }
.drv-p-2 { padding: 16px; }
.drv-p-3 { padding: 24px; }
