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

:root {
  --rw-primary: #1E40AF;
  --rw-primary-dark: #1E3A8A;
  --rw-primary-light: #EEF2FF;
  --rw-accent: #3B82F6;
  --rw-bg: #F1F5F9;
  --rw-surface: #FFFFFF;
  --rw-text: #0F172A;
  --rw-muted: #64748B;
  --rw-border: #E2E8F0;
  --rw-danger: #DC2626;
  --rw-success: #059669;
  --rw-warning: #D97706;
  --rw-radius: 16px;
  --rw-shadow: 0 1px 3px rgba(15,23,42,.06);
  --rw-shadow-md: 0 4px 16px -4px rgba(15,23,42,.12);
  --rw-shadow-lg: 0 20px 40px -12px rgba(15,23,42,.15);
  --rw-safe-bottom: env(safe-area-inset-bottom, 0px);
  --rw-safe-top: env(safe-area-inset-top, 0px);
  --rw-page-pad: clamp(0.75rem, 2.5vw, 2rem);
  --rw-nav-h: 70px;
  --rw-content-max: 100%;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--rw-bg);
  color: var(--rw-text);
  margin: 0;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.5;
  overflow-x: hidden;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  font-size: 16px;
}

img, video, canvas, svg { max-width: 100%; height: auto; display: block; }
table { width: 100%; border-collapse: collapse; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 999px; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--rw-primary);
  outline-offset: 2px;
}

/* =========================================================
   FULL-WIDTH FLUID SHELL — no size lock on any device
   ========================================================= */
.rw-viewport {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: block;
  background: var(--rw-bg);
}

.rw-shell {
  width: 100%;
  max-width: none !important; /* never bound */
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--rw-surface);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  overflow-y: visible;
  color: var(--rw-text);
}

.rw-shell--auth {
  width: 100%;
  max-width: none !important;
  min-height: 100dvh;
}

.rw-shell-body {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Scrollable content area — body still scrolls; this adds padding for floating nav */
.rw-scroll {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  overflow: visible !important;
  -webkit-overflow-scrolling: touch;
  padding-left: var(--rw-page-pad);
  padding-right: var(--rw-page-pad);
  padding-bottom: calc(var(--rw-nav-h) + 24px + var(--rw-safe-bottom));
}

/* Optional inner content centering without locking the page */
.rw-content {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 1400px) {
  .rw-content { max-width: 1400px; }
}

/* =========================================================
   FLOATING BOTTOM NAV — all screen sizes
   ========================================================= */
.rw-bottom-nav {
  position: fixed !important;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(12px, var(--rw-safe-bottom));
  z-index: 100;
  width: calc(100% - 24px);
  max-width: 560px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 22px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

@media (min-width: 768px) {
  .rw-bottom-nav {
    max-width: 640px;
    padding: 10px 16px;
  }
}

@media (min-width: 1024px) {
  .rw-bottom-nav {
    max-width: 720px;
  }
}

.rw-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  color: #94A3B8;
  text-decoration: none;
  padding: 8px 4px;
  border-radius: 14px;
  transition: color .15s, background .15s, transform .12s;
  font-size: 10px;
  font-weight: 700;
  gap: 3px;
  min-width: 0;
  min-height: 44px;
}
.rw-nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.rw-nav-item.active {
  color: var(--rw-primary);
  background: var(--rw-primary-light);
}
.rw-nav-item:active { transform: scale(0.96); }

.rw-nav-fab {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1E40AF, #3B82F6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px -4px rgba(30, 64, 175, 0.55);
  flex-shrink: 0;
  margin-top: -20px;
  text-decoration: none;
  transition: transform .12s;
}
.rw-nav-fab:active { transform: scale(0.94); }

/* =========================================================
   DASHBOARD — full fluid width
   ========================================================= */
.rw-dash-body {
  margin: 0;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #F1F5F9;
  overflow-x: hidden;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.rw-dash-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem var(--rw-page-pad) 3rem;
  overflow: visible !important;
}

@media (min-width: 768px) {
  .rw-dash-main {
    padding: 1.5rem var(--rw-page-pad) 3rem;
  }
}

@media (min-width: 1024px) {
  .rw-dash-main {
    padding: 1.75rem clamp(1.5rem, 4vw, 3rem) 3rem;
  }
}

/* =========================================================
   FLOATING ACTION BUTTONS
   ========================================================= */
.rw-float-btn,
button.rw-float-btn,
a.rw-float-btn {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(var(--rw-nav-h) + 28px + var(--rw-safe-bottom));
  z-index: 90;
  min-height: 52px;
  min-width: 52px;
  padding: 0 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1E40AF, #3B82F6);
  color: #fff !important;
  font-weight: 700;
  font-size: 13px;
  border: none;
  box-shadow: 0 10px 28px rgba(30, 64, 175, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.rw-float-btn:active {
  transform: scale(0.96);
  box-shadow: 0 6px 16px rgba(30, 64, 175, 0.35);
}

/* Primary action bars that float at bottom of forms */
.rw-fixed-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--rw-border);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
  padding: 12px var(--rw-page-pad);
  padding-bottom: calc(12px + var(--rw-safe-bottom));
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.rw-fixed-actions > button,
.rw-fixed-actions > a {
  flex: 1 1 auto;
  min-height: 48px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 13px;
}

/* All interactive buttons — touch friendly */
button,
[type="submit"],
[type="button"],
.btn {
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
}

input, select, textarea, button { font-family: inherit; max-width: 100%; }

input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="search"],
input[type="time"], input[type="date"], select, textarea {
  width: 100%;
  font-size: 16px; /* no iOS zoom */
  border-radius: 12px;
}

@media (min-width: 768px) {
  input[type="text"], input[type="email"], input[type="password"],
  input[type="tel"], input[type="number"], input[type="search"],
  input[type="time"], input[type="date"], select, textarea {
    font-size: 14px;
  }
}

/* Grids scale with screen */
.rw-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.rw-grid-3, .rw-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (min-width: 640px) {
  .rw-grid-2 { grid-template-columns: 1fr 1fr; }
  .rw-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .rw-grid-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .rw-grid-2, .rw-grid-3, .rw-grid-4 { gap: 1.25rem; }
}

/* Maps */
.rw-map, #pickup-map, #tracking-map, #rider-map, #self-map, #map, #addr-map {
  width: 100% !important;
  max-width: 100%;
}
.leaflet-container { width: 100% !important; font-size: 12px; }

.rw-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-none::-webkit-scrollbar { display: none; }

p, h1, h2, h3, h4, h5, h6, span, a, label, li {
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* Headers full width */
header, .border-b {
  width: 100%;
}

/* Remove leftover phone-frame constraints from any page inline styles */
.rw-shell[style],
.rw-viewport[style] {
  max-width: none !important;
}

/* Auth pages: still full width, content readable */
.rw-shell--auth .rw-scroll {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}
@media (min-width: 768px) {
  .rw-shell--auth .rw-scroll {
    max-width: 520px;
  }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .rw-scroll { padding-bottom: calc(56px + var(--rw-safe-bottom)); }
  .rw-bottom-nav { padding: 4px 10px; border-radius: 16px; }
  .rw-nav-fab { width: 44px; height: 44px; margin-top: -12px; }
}

/* Very small phones */
@media (max-width: 359px) {
  .rw-nav-item span { font-size: 9px; }
  .rw-nav-fab { width: 46px; height: 46px; margin-top: -14px; }
}

@media print {
  .rw-bottom-nav, .rw-float-btn, .rw-fixed-actions { display: none !important; }
  .rw-scroll { padding-bottom: 0 !important; }
}
