/* ============================================================================
   Bahari phone apps (Ride and Captain): shared look.

   THIS FILE IS THE SAME IN ride/ AND captain/.
   If you change it, copy it to the other folder.

   Colours live in the :root block right below. Each app picks its main
   colour with a class on <body>: "app-ride" (ocean blue) or
   "app-captain" (coral).
   ========================================================================= */

:root {
  --ocean: #0ea5e9;
  --deep: #0369a1;
  --sand: #fde68a;
  --coral: #f97316;
  --wood: #92400e;
  --success: #22c55e;
  --danger: #ef4444;
  --dark: #1e293b;
  --gray: #64748b;      /* text on white: darker than the Flutter grey so it is easy to read */
  --gray-light: #94a3b8;
  --line: #e2e8f0;
  --light-bg: #f1f5f9;
  --white: #ffffff;

  --accent: var(--ocean);
  --radius: 14px;
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
body.app-captain { --accent: var(--coral); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--dark);
  background: var(--dark); /* shows around the phone-width app on laptops */
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

/* The app stays phone-width on wide screens; real phones are unaffected. */
#app {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--light-bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

.screen { flex: 1; display: flex; flex-direction: column; min-height: 100%; }
.content { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.content.pad-nav { padding-bottom: 84px; }
.center { text-align: center; }
.muted { color: var(--gray); }
.small { font-size: 12px; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.emoji-xl { font-size: 56px; line-height: 1; }
.emoji-l { font-size: 40px; line-height: 1; }

/* ---------------------------------------------------------------- Top bar -- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 12px 8px 16px;
  background: var(--bar, var(--accent));
  color: var(--white);
}
.topbar h1 { font-size: 18px; font-weight: 700; flex: 1; }
.topbar.bar-ocean { --bar: var(--ocean); }
.topbar.bar-deep { --bar: var(--deep); }
.topbar.bar-coral { --bar: var(--coral); }
.topbar.bar-success { --bar: var(--success); }
.topbar.bar-dark { --bar: var(--dark); }
.topbar.bar-light { --bar: var(--white); color: var(--dark); border-bottom: 1px solid var(--line); }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  font-size: 18px;
  flex: none;
}
.bar-light .icon-btn { background: var(--light-bg); }

/* ------------------------------------------------------ Language toggle -- */
.lang-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: transparent;
  gap: 0;
}
.lang-toggle span {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray);
  transition: background 0.18s, color 0.18s;
}
.lang-toggle span.on { background: var(--accent); color: var(--white); }
.lang-toggle.on-dark { border-color: rgba(255, 255, 255, 0.5); }
.lang-toggle.on-dark span { color: var(--white); }
.lang-toggle.on-dark span.on { background: var(--white); color: var(--accent); }

/* ---------------------------------------------------------------- Buttons -- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: filter 0.15s, opacity 0.15s;
}
.btn:hover:not(:disabled) { filter: brightness(0.96); }
.btn:disabled { opacity: 0.65; cursor: default; }
.btn.block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-ocean { background: var(--ocean); color: var(--white); }
.btn-coral { background: var(--coral); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-white { background: var(--white); color: var(--ocean); }
.btn-outline-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-outline { background: var(--white); color: var(--accent); border-color: var(--accent); }
.btn-plain { background: transparent; color: var(--gray); }
.btn-link { background: none; border: 0; min-height: 40px; color: inherit; font-weight: 600; padding: 8px; text-decoration: none; display: inline-flex; align-items: center; }
.btn-link:hover { text-decoration: underline; }
.btn.is-busy { color: transparent !important; }
.btn.is-busy::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: var(--white);
  animation: spin 0.8s linear infinite;
}
.btn-white.is-busy::after, .btn-outline.is-busy::after, .btn-plain.is-busy::after,
.btn-outline-danger.is-busy::after { border-color: var(--line); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ----------------------------------------------------------------- Forms -- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--gray); }
.field .help { font-size: 12px; color: var(--gray); }
.input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  background: var(--white);
  font-size: 16px; /* 16px stops phones zooming in */
  outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15); }
.input.pin { text-align: center; font-size: 24px; letter-spacing: 10px; }
.form-error { color: var(--danger); font-size: 14px; }

/* ----------------------------------------------------------------- Cards -- */
.card {
  background: var(--white);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card-gradient {
  border-radius: 16px;
  padding: 18px;
  color: var(--white);
  background: linear-gradient(135deg, var(--ocean), var(--deep));
}
.card-gradient.coral { background: linear-gradient(135deg, var(--coral), var(--wood)); }
.card-gradient hr { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.2); margin: 14px 0; }
.stat { text-align: center; flex: 1; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; opacity: 0.85; }

.tap-card {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--white);
  transition: border-color 0.15s, transform 0.1s;
}
a.tap-card { text-decoration: none; color: inherit; }
.tap-card:hover { border-color: var(--accent); }
.tap-card:active { transform: scale(0.99); }
.tap-card .tile {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--sand);
  display: grid;
  place-items: center;
  font-size: 24px;
  flex: none;
}
.tap-card .title { font-weight: 600; flex: 1; }
.chev { color: var(--gray-light); font-size: 22px; }

.service-card { flex-direction: column; text-align: center; padding: 22px; border-radius: 20px; box-shadow: var(--shadow); }
.service-card .icon { font-size: 44px; }
.service-card .title { font-size: 16px; font-weight: 700; }

.boat-card { flex-direction: column; align-items: stretch; gap: 6px; padding: 14px; border-radius: 18px; }
.boat-card .hero {
  height: 120px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 52px;
  background: linear-gradient(90deg, var(--ocean), var(--deep));
}
.boat-card .name { font-weight: 700; font-size: 16px; }
.price { color: var(--coral); font-weight: 800; font-size: 20px; }

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--sand);
  display: grid;
  place-items: center;
  font-size: 24px;
  flex: none;
}
.avatar.lg { width: 80px; height: 80px; font-size: 40px; }
.avatar.initials { background: var(--white); color: var(--deep); font-weight: 800; font-size: 26px; width: 76px; height: 76px; }

.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; }
.detail-row span:first-child { color: var(--gray); }
.detail-row span:last-child { font-weight: 600; text-align: right; }

.trip-card { background: var(--white); border-radius: var(--radius); padding: 14px; display: block; width: 100%; text-align: left; border: 0; }
button.trip-card:hover { box-shadow: 0 0 0 2px var(--line); }
.trip-card .route { font-weight: 700; flex: 1; }
.trip-card .amount { color: var(--accent); font-weight: 700; font-size: 14px; white-space: nowrap; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-sky { background: #e0f2fe; color: var(--deep); }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: var(--light-bg); color: var(--gray); }
.count-pill { background: var(--ocean); color: var(--white); border-radius: 10px; padding: 2px 10px; font-size: 12px; font-weight: 700; }

.empty { text-align: center; color: var(--gray); padding: 28px 16px; }
.empty .emoji-l { display: block; margin-bottom: 8px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented button {
  min-height: 42px;
  border-radius: var(--radius);
  border: 2px solid var(--accent);
  background: var(--white);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}
.segmented button.on { background: var(--accent); color: var(--white); }

.steps { display: flex; justify-content: center; gap: 8px; }
.steps i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.steps i.on { background: var(--ocean); }

.section-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray); margin: 6px 4px -4px; }
.list-group { background: var(--white); border-radius: var(--radius); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 56px; }
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-item .li-icon { font-size: 20px; width: 24px; text-align: center; flex: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-sub { color: var(--gray); font-size: 14px; word-break: break-word; }

.notice { background: rgba(239, 68, 68, 0.08); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }

/* ----------------------------------------------------------- Bottom nav -- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 6;
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 10px;
  text-decoration: none;
  font-size: 11px;
  color: var(--gray);
}
.bottom-nav a .ic { font-size: 20px; line-height: 1.2; }
.bottom-nav a.on { color: var(--accent); font-weight: 700; }

/* --------------------------------------------------------------- Toggle -- */
.switch {
  width: 50px;
  height: 28px;
  border-radius: 14px;
  border: 0;
  padding: 3px;
  background: var(--line);
  display: flex;
  transition: background 0.25s;
  flex: none;
}
.switch::after {
  content: '';
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s;
}
.switch[aria-checked='true'] { background: var(--success); }
.switch[aria-checked='true']::after { transform: translateX(22px); }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--gray-light); flex: none; }
.dot.on { background: var(--success); }

/* -------------------------------------------------------- Login (Ride) -- */
.landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  color: var(--white);
  background: linear-gradient(180deg, var(--ocean), var(--deep), var(--dark));
}
.landing .brand { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 220px; }
.landing .brand h1 { font-size: 30px; font-weight: 800; }
.landing .brand p { font-size: 14px; color: rgba(255, 255, 255, 0.8); text-align: center; }
.bob { font-size: 72px; line-height: 1; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(-6px); } 50% { transform: translateY(6px); } }
.landing form { display: flex; flex-direction: column; gap: 12px; }
.landing .field label { color: rgba(255, 255, 255, 0.85); }
.landing .input { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.45); color: var(--white); }
.landing .input:focus { border-color: var(--white); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15); }
.landing .form-error { color: var(--sand); }
.landing .links { display: flex; flex-direction: column; align-items: center; }
.landing .links .btn-link { color: rgba(255, 255, 255, 0.85); }
.landing .links .btn-link.strong { color: var(--white); }
.landing .terms { text-align: center; font-size: 12px; color: rgba(255, 255, 255, 0.55); padding-top: 18px; }
.landing .lang-wrap { display: flex; justify-content: flex-end; }

.big-id { font-size: 44px; font-weight: 800; letter-spacing: 6px; color: var(--ocean); text-align: center; user-select: all; }

/* --------------------------------------------- Waiting for a captain -- */
.ocean {
  position: relative;
  flex: 1;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: #75cbe8;
}
.ocean .island { position: absolute; background: #f4d78a; border-radius: 50%; }
.ocean .island.a { width: 190px; height: 105px; left: 18%; top: 30%; transform: translate(-50%, -50%); }
.ocean .island.b { width: 170px; height: 90px; left: 82%; top: 58%; transform: translate(-50%, -50%); }
.ocean .waves {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='42'%3E%3Cpath d='M0 21 Q25 14 50 21 T100 21 T150 21 T200 21' fill='none' stroke='white' stroke-opacity='0.3' stroke-width='2'/%3E%3C/svg%3E");
  background-size: 200px 42px;
  animation: drift 5s linear infinite;
}
@keyframes drift { to { background-position: 200px 0; } }
.ocean .sailing { position: absolute; font-size: 36px; left: 34%; top: 36%; animation: sail 10s ease-in-out infinite alternate; }
@keyframes sail { to { left: 60%; top: 46%; } }
.ocean .home-btn { position: absolute; top: 16px; left: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--white); font-size: 20px; box-shadow: var(--shadow); }
.ocean .panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--white);
  border-radius: 28px 28px 0 0;
  padding: 14px 24px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.sheet-handle { width: 42px; height: 4px; border-radius: 8px; background: var(--line); margin: 0 auto 10px; flex: none; }
.ocean .panel h2 { font-size: 20px; font-weight: 800; }

/* ----------------------------------------------------- Pop-ups and toast -- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.5);
  opacity: 0;
  transition: opacity 0.18s;
}
.modal-backdrop.show { opacity: 1; }
.modal {
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--white);
  border-radius: 20px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-title { font-size: 19px; font-weight: 800; }
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal-actions .btn { min-height: 44px; }
.modal-backdrop.is-sheet { place-items: end center; padding: 0; }
.is-sheet .modal { max-width: 480px; border-radius: 28px 28px 0 0; padding: 14px 24px 30px; transform: translateY(30px); transition: transform 0.2s; }
.is-sheet.show .modal { transform: none; }
.is-sheet .modal-title { text-align: center; }
.is-sheet .modal-actions { flex-direction: column-reverse; }
.is-sheet .modal-actions .btn { width: 100%; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 28px; }
.stepper button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ocean); color: var(--white); font-size: 24px; font-weight: 700; }
.stepper button:disabled { background: var(--line); cursor: default; }
.stepper output { font-size: 34px; font-weight: 800; min-width: 40px; text-align: center; }
.fare-box { background: #fff1f0; border-radius: 16px; padding: 16px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; }

.pay-option { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--white); font-weight: 600; text-align: left; }
.pay-option .ic { font-size: 28px; }
.pay-option[aria-checked='true'] { border-color: var(--success); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 60;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 12px;
  color: var(--white);
  background: var(--dark);
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--danger); }
.toast-success { background: #15803d; }

.splash { flex: 1; display: grid; place-items: center; min-height: 100vh; background: var(--light-bg); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
