@import url('layout.css');

/*
  Phone-country picker — a custom combobox, not a native <select>. A
  native select's OPEN dropdown list has no reliable cross-browser CSS to
  cap its height: with ~245 countries it rendered as one long list
  spilling far past the modal/viewport (confirmed visually — the list ran
  off past the visible page). This div-based version gives real control:
  a short, scrollable panel instead. Populated entirely by
  Validators.attachPhoneField() in js/validators.js.
*/
.phone-country-field { position: relative; flex: 0 0 108px; min-width: 0; }
.phone-country-trigger {
  width: 100%; padding: 9px 8px; font-size: 12.5px; font-family: inherit; text-align: left;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  color: inherit; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 4px;
}
.phone-country-trigger:focus, .phone-country-trigger.open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.phone-country-trigger .arrow { font-size: 10px; opacity: 0.6; flex-shrink: 0; }
.phone-country-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; width: 190px;
  max-height: 200px; overflow-y: auto; background: var(--card); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-modal); display: none;
}
.phone-country-menu.open { display: block; }
.phone-country-option { padding: 7px 10px; font-size: 12.5px; cursor: pointer; }
.phone-country-option:hover { background: var(--surface); }

/* Status (same signature indicator-dot as the staff dashboard, for brand consistency) */
.status {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--signal-grey-soft); color: var(--ink-700);
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--signal-grey); box-shadow: 0 0 5px var(--signal-grey); }
.status.green { background: var(--signal-green-soft); } .status.green .dot { background: var(--signal-green); box-shadow: 0 0 5px var(--signal-green); }
.status.red { background: var(--signal-red-soft); } .status.red .dot { background: var(--signal-red); box-shadow: 0 0 5px var(--signal-red); }
.status.blue { background: var(--signal-blue-soft); } .status.blue .dot { background: var(--signal-blue); box-shadow: 0 0 5px var(--signal-blue); }
.status.amber { background: var(--signal-amber-soft); } .status.amber .dot { background: var(--signal-amber); box-shadow: 0 0 5px var(--signal-amber); }

/* Hero (Home) — editorial hero: eyebrow location tag, large serif
   headline, floating white search widget anchored at the bottom, and a
   rail of circular quick-link icons along the right edge. */
.hero {
  min-height: 60vh; display: flex; flex-direction: column; justify-content: flex-end;
  background: radial-gradient(ellipse 900px 600px at 50% 0%, var(--hero-glow), transparent 60%);
  color: var(--ink-950); padding: 96px 32px 24px; position: relative; overflow: hidden;
}
.hero-inner { max-width: 780px; margin: 0 auto; width: 100%; position: relative; z-index: 1; text-align: center; }
.hero .eyebrow {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-700); background: var(--chip-bg); border: 1px solid var(--line-strong);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(34px, 5.5vw, 58px); line-height: 1.1; color: var(--ink-950); letter-spacing: -0.01em;
  text-align: center; font-weight: 600;
}
.hero h1 span { display: block; }
.hero p { color: var(--ink-700); margin-top: 16px; font-size: 15.5px; max-width: 420px; text-align: center; margin-left: auto; margin-right: auto; }

.hero-icon-rail { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 14px; z-index: 2; }
.hero-icon-rail a {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--chip-bg);
  display: flex; align-items: center; justify-content: center; color: var(--ink-900); text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.hero-icon-rail a:hover { background: var(--chip-bg-strong); transform: translateY(-2px); }
@media (max-width: 720px) { .hero-icon-rail { display: none; } }

/* The floating search widget — always a white card regardless of theme
   (like the reference's search card), tokenized so its border/label
   colors still track the active palette instead of being hardcoded. */
.search-widget {
  margin: 36px auto 0; max-width: 720px; background: #ffffff; border-radius: var(--radius-lg);
  padding: 20px 24px; box-shadow: var(--shadow-modal); color: #22243a;
}
.search-widget .row { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-end; }
.search-widget .field { flex: 1; min-width: 150px; margin: 0; }
.search-widget .field:not(:first-child) { border-left: 1px solid var(--line-strong); padding-left: 22px; }
.search-widget .field label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-600); }
.search-widget .field input, .search-widget .field select {
  border: none; border-radius: 0; padding: 6px 0; background: transparent; color: #22243a; font-size: 14.5px; font-weight: 500; width: 100%;
}
.search-widget .field input:focus, .search-widget .field select:focus { outline: none; box-shadow: none; }
/* Search is the single primary action in the hero, so it's the one
   place red (the CTA-only accent) appears as a button fill. */
.search-widget .btn-primary {
  background: var(--route); color: #fff; border-radius: 999px; padding: 13px 26px; flex: none;
}
.search-widget .btn-primary:hover { background: #a3271b; }
@media (max-width: 720px) { .search-widget .field:not(:first-child) { border-left: none; padding-left: 0; } }

.search-bar {
  max-width: 760px; margin: 32px auto 0; background: linear-gradient(180deg, var(--card-alt), var(--card)); border-radius: var(--radius-lg); padding: 16px;
  display: flex; gap: 10px; flex-wrap: wrap; box-shadow: var(--shadow-modal); border: 1px solid var(--line);
}
.search-bar .field { flex: 1; min-width: 140px; margin: 0; }
.search-bar input { width: 100%; }
.search-bar-page { max-width: none; margin: 20px 0 0; align-items: flex-end; }
.kv-block { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }

/* Vehicle grid + card */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 260px)); justify-content: start; gap: 20px; margin-top: 22px; }
.vehicle-card {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0) 45%),
    linear-gradient(180deg, var(--card-alt), var(--card));
  box-shadow: var(--shadow-card); transition: transform 0.16s ease, box-shadow 0.16s ease; cursor: pointer;
}
.vehicle-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.vehicle-card .photo { height: 148px; background: linear-gradient(135deg, var(--card-alt), var(--paper)); display: flex; align-items: center; justify-content: center; color: var(--ink-400); font-size: 12px; position: relative; }
.vehicle-card .photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.4)); pointer-events: none; }
.vehicle-card .body { padding: 15px 16px 16px; position: relative; }
.vehicle-card .body::before { content: ''; position: absolute; top: 0; left: 16px; right: 16px; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.vehicle-card .body h3 { font-size: 15.5px; }
.vehicle-card .body .meta { color: var(--ink-600); font-size: 12px; margin-top: 5px; }
.vehicle-card .body .price { margin-top: 11px; font-family: var(--font-mono); font-weight: 700; font-size: 14px; color: var(--accent-ink); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { padding: 10px 14px; background: none; border: none; border-bottom: 2px solid transparent; font-weight: 600; font-size: 13px; color: var(--ink-600); cursor: pointer; }
.tabs button.active { color: var(--ink-900); border-bottom-color: var(--accent); }

/* Tables (reused for booking history, documents) */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th {
  text-align: left; padding: 10px 14px; background: var(--surface); color: var(--ink-600);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; border-bottom: 1px solid var(--line);
}
table.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tbody tr:hover { background: var(--surface); }
table.data-table tbody tr.clickable { cursor: pointer; }
.table-empty { padding: 40px 20px; text-align: center; color: var(--ink-600); }

/* Modal (identical to staff dashboard) */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; animation: fadeIn 0.15s ease; }
.modal {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0) 35%),
    var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-modal); width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; animation: slideUp 0.18s ease;
}
.modal.modal-wide { max-width: 720px; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: 16px; }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--ink-600); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Toast */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--card-alt); border: 1px solid var(--line-strong); color: var(--ink-950); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; box-shadow: var(--shadow-modal); min-width: 240px; animation: slideUp 0.18s ease; }
.toast.error { background: var(--signal-red); }
.toast.success { background: var(--signal-green); }

/* Chat widget — floating launcher + panel. z-index kept below the toast
   stack (100) so a toast is never visually hidden behind an open chat panel. */
.chat-launcher {
  position: fixed; bottom: 20px; right: 20px; z-index: 95; width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; font-size: 22px;
  box-shadow: var(--shadow-modal); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease;
}
.chat-launcher:hover { transform: translateY(-2px); }

/* Sits to the LEFT of the chat launcher (right: 84px = 20px base + 52px
   launcher width + 12px gap) rather than stacked above it — stacking
   above would sit under the chat panel's own footprint (which opens at
   bottom: 84px) once that's expanded. */
.whatsapp-button {
  position: fixed; bottom: 20px; right: 84px; z-index: 95; width: 52px; height: 52px; border-radius: 50%;
  background: #25d366; color: #fff; box-shadow: var(--shadow-modal); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: transform 0.15s ease;
}
.whatsapp-button:hover { transform: translateY(-2px); }

.chat-panel {
  position: fixed; bottom: 84px; right: 20px; z-index: 90; width: 340px; max-width: calc(100vw - 40px);
  height: 460px; max-height: calc(100vh - 120px); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-modal); display: flex; flex-direction: column;
  overflow: hidden; animation: slideUp 0.18s ease;
}
.chat-panel.hidden { display: none; }
.chat-panel-header {
  padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; font-weight: 600; font-size: 14px;
}
.chat-panel-close { background: none; border: none; font-size: 20px; color: var(--ink-600); cursor: pointer; line-height: 1; }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { display: flex; }
.chat-msg-them { justify-content: flex-start; }
.chat-msg-me { justify-content: flex-end; }
.chat-bubble { max-width: 80%; padding: 9px 13px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.chat-msg-them .chat-bubble { background: var(--surface); border: 1px solid var(--line); color: var(--ink-950); }
.chat-msg-me .chat-bubble { background: var(--accent); color: #fff; }
.chat-guest-fields { display: flex; gap: 8px; padding: 0 16px 10px; }
.chat-guest-fields.hidden { display: none; }
.chat-guest-fields input { flex: 1; font-size: 13px; padding: 7px 10px; }
.chat-input-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.chat-input-form .chat-input { flex: 1; font-size: 13px; }
/* Explicit background/border/color: unlike .field's inputs elsewhere,
   these aren't wrapped in .field, so without this they fall back to the
   browser's default WHITE input background while still inheriting this
   dark theme's near-white body text color (--ink-950) — invisible white-
   on-white text while typing, confirmed as the actual reported bug. */
.chat-guest-fields input, .chat-input-form .chat-input {
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  color: var(--ink-950);
}
.chat-guest-fields input:focus, .chat-input-form .chat-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none;
}
.chat-guest-fields input::placeholder, .chat-input-form .chat-input::placeholder { color: var(--ink-400); }
.chat-restart-row { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 14px 16px; text-align: center; }
.chat-restart-row span { font-size: 12.5px; color: var(--ink-600); }

/* Timeline (booking detail) */
.timeline { list-style: none; padding: 0; }
.timeline li { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 16px; bottom: 0; width: 1px; background: var(--line-strong); }
.timeline li:last-child::before { display: none; }
.timeline .marker { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); margin-top: 3px; flex-shrink: 0; box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline .content { font-size: 13px; }
.timeline .meta { font-size: 11px; color: var(--ink-600); margin-top: 2px; }

.doc-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: none; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-600); }
.empty-state h3 { color: var(--ink-900); margin-bottom: 6px; }
