/* ============================================================
   FullCircle V2 — Glassmorphic Dark Design System
   Matches screenshot_mobile.png aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --v2-bg-space: #070a12;
  --v2-bg-surface: #0e1424;
  --v2-glass-bg: rgba(15, 22, 38, 0.78);
  --v2-glass-bg-hover: rgba(22, 32, 54, 0.85);
  --v2-glass-border: rgba(255, 255, 255, 0.08);
  --v2-glass-border-bright: rgba(255, 255, 255, 0.16);
  
  --v2-primary: #3b82f6;
  --v2-primary-glow: rgba(59, 130, 246, 0.4);
  --v2-accent: #0ea5e9;
  --v2-accent-glow: rgba(14, 165, 233, 0.4);
  --v2-coral: #ff6b4a;
  
  --v2-text-main: #ffffff;
  --v2-text-muted: #94a3b8;
  --v2-text-subtle: #64748b;
  
  --v2-status-green: #10b981;
  --v2-status-orange: #f59e0b;
  --v2-status-gray: #64748b;
  
  --v2-font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --v2-radius-xl: 24px;
  --v2-radius-lg: 18px;
  --v2-radius-md: 12px;
  --v2-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Base resets for V2 */
.v2-body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--v2-bg-space);
  background-image: 
    radial-gradient(circle at 10% 15%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 85%, rgba(14, 165, 233, 0.12) 0%, transparent 45%);
  font-family: var(--v2-font);
  color: var(--v2-text-main);
  -webkit-font-smoothing: antialiased;
}

/* Outer layout wrapper */
.v2-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 100%;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

/* Glassmorphic Panel Utility */
.v2-glass-card {
  background: var(--v2-glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--v2-glass-border);
  border-radius: var(--v2-radius-xl);
  box-shadow: var(--v2-shadow);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

/* Top Header with Safe Area Insets (Prevents overlapping phone notification / status bar) */
.v2-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: calc(14px + max(24px, env(safe-area-inset-top, 24px)));
  padding-bottom: 12px;
  padding-left: 20px;
  padding-right: 20px;
  z-index: 100;
}

.v2-header-title {
  display: flex;
  flex-direction: column;
}

.v2-greeting {
  font-size: 15px;
  font-weight: 400;
  color: var(--v2-text-muted);
  letter-spacing: -0.2px;
}

.v2-family-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--v2-text-main);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

/* Glassmorphic Circle Selector Dropdown */
.v2-circle-select {
  background: rgba(255, 255, 255, 0.08);
  color: var(--v2-text-main);
  border: 1px solid var(--v2-glass-border-bright);
  border-radius: 12px;
  padding: 4px 28px 4px 10px;
  font-family: var(--v2-font);
  font-size: 18px;
  font-weight: 800;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  transition: all 0.2s ease;
  max-width: 220px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  margin-top: 2px;
}

.v2-circle-select option {
  background: #0f172a;
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
}

.v2-circle-select:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(56, 189, 248, 0.6);
}

.v2-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.v2-brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(14, 165, 233, 0.2) 100%);
  border: 1px solid var(--v2-glass-border-bright);
}

.v2-avatar-badge {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: visible;
  cursor: pointer;
}

.v2-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--v2-primary);
}

.v2-avatar-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: var(--v2-coral);
  border: 2px solid var(--v2-bg-space);
  border-radius: 50%;
}

/* Switch UI Button */
.v2-switch-ui-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #a5f3fc;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: 20px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.v2-switch-ui-btn:hover {
  background: rgba(14, 165, 233, 0.28);
  transform: translateY(-1px);
}

/* Map Canvas Container (Expanded upper area) */
.v2-map-section {
  position: relative;
  flex: 2 1 45vh;
  min-height: 300px;
  width: calc(100% - 32px);
  margin: 0 16px;
  border-radius: var(--v2-radius-xl);
  overflow: hidden;
}

#v2-map-canvas {
  width: 100%;
  height: 100%;
  background: #080c16;
}

/* Floating Route Overlay Pill */
.v2-route-pill {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(11, 17, 31, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--v2-glass-border-bright);
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
  white-space: nowrap;
  max-width: 92%;
}

.v2-pill-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
}

.v2-pill-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.v2-pill-icon.current { background: #3b82f6; }
.v2-pill-icon.dest { background: var(--v2-coral); }

.v2-pill-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.v2-pill-label {
  font-size: 10px;
  color: var(--v2-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.v2-pill-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--v2-text-main);
}

.v2-pill-arrow {
  color: var(--v2-text-muted);
  font-size: 13px;
  font-weight: 600;
}

/* Scrollable Dashboard Body Cards (Anchored towards bottom, just above tool tray) */
.v2-content-scroll {
  flex: 1 1 45%;
  max-height: 52%;
  overflow-y: auto;
  padding: 12px 16px calc(82px + max(12px, env(safe-area-inset-bottom, 12px))) 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  margin-top: auto;
}

.v2-content-scroll::-webkit-scrollbar {
  display: none;
}

/* 1. On Route to Home Card */
.v2-trip-card {
  padding: 16px 20px;
}

.v2-trip-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--v2-text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v2-trip-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
  margin-bottom: 14px;
}

.v2-metric-col {
  display: flex;
  flex-direction: column;
}

.v2-metric-label {
  font-size: 11px;
  color: var(--v2-text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.v2-metric-val {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--v2-text-main);
}

/* Cyan Glowing Progress Line */
.v2-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.v2-progress-fill {
  height: 100%;
  width: 65%;
  background: linear-gradient(90deg, #3b82f6 0%, #0ea5e9 100%);
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.8);
  transition: width 0.4s ease;
}

/* 2. Family Members Active Carousel */
.v2-family-card {
  padding: 16px 18px;
}

.v2-section-head {
  font-size: 15px;
  font-weight: 700;
  color: var(--v2-text-main);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.v2-family-carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.v2-family-carousel::-webkit-scrollbar {
  display: none;
}

.v2-member-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 76px;
}

.v2-member-avatar-ring {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  padding: 3px;
  margin-bottom: 6px;
}

.v2-member-avatar-ring.active-ride {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.v2-member-avatar-ring.en-route {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

.v2-member-avatar-ring.idle {
  background: rgba(255, 255, 255, 0.15);
}

.v2-member-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  overflow: hidden;
}

.v2-member-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid var(--v2-bg-space);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

.v2-member-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--v2-text-main);
  text-align: center;
  white-space: nowrap;
}

.v2-member-status {
  font-size: 10.5px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.v2-member-status.active-ride { color: #34d399; }
.v2-member-status.en-route { color: #fbbf24; }
.v2-member-status.idle { color: var(--v2-text-muted); }

/* 3. Driver Performance Card */
.v2-driver-card {
  padding: 16px 18px;
}

.v2-driver-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.v2-driver-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.v2-driver-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.v2-driver-name-text {
  font-size: 15px;
  font-weight: 800;
  color: var(--v2-text-main);
}

.v2-driver-sub {
  font-size: 11.5px;
  color: var(--v2-text-muted);
}

.v2-driver-stats-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.v2-stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.v2-stat-num {
  font-size: 14px;
  font-weight: 800;
  color: var(--v2-text-main);
}

.v2-stat-sub {
  font-size: 10px;
  color: var(--v2-text-muted);
}

.v2-sparkline-svg {
  width: 50px;
  height: 24px;
}

/* Bottom Navigation Floating Dock with Safe Area Bottom Inset */
.v2-bottom-dock {
  position: absolute;
  bottom: calc(14px + max(0px, env(safe-area-inset-bottom, 0px)));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 440px;
  z-index: 500;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--v2-glass-border-bright);
  border-radius: 35px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.v2-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  border-radius: 20px;
  color: var(--v2-text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.v2-nav-tab.active {
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.15);
}

.v2-nav-icon {
  font-size: 18px;
}

/* V2 Modal Overlay & Trip Type Selection Cards */
.v2-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10005;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 10, 18, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px;
}

.v2-modal-overlay.hidden {
  display: none !important;
}

.v2-modal-glass-card {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--v2-glass-border-bright);
  border-radius: 28px;
  padding: 24px 20px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v2-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.v2-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--v2-text-main);
  margin: 0;
}

.v2-modal-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.v2-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.v2-modal-sub {
  font-size: 13px;
  color: var(--v2-text-muted);
  margin: 0 0 4px 0;
}

.v2-trip-type-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v2-trip-type-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--v2-glass-border);
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.v2-trip-type-card:hover {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
}

.v2-trip-type-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.v2-trip-type-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.v2-trip-type-info h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--v2-text-main);
}

.v2-trip-type-info p {
  margin: 2px 0 0 0;
  font-size: 11.5px;
  color: var(--v2-text-muted);
  line-height: 1.3;
}

.v2-trip-type-arrow {
  color: #38bdf8;
  font-size: 16px;
  font-weight: 800;
}
