/* Brand colour tokens */
:root {
  --color-primary: #0A2A5E;       /* Deep Blue */
  --color-accent: #F47920;        /* Orange */
  --color-gold: #D4AF37;          /* Gold */
  --color-white: #FFFFFF;
  --color-black: #111111;
  --color-gray-light: #F4F4F4;
  --color-error: #D32F2F;
  --color-success: #2E7D32;

  --header-height: 56px;
  --nav-height: 64px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);

  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --touch-target-min: 48px;

  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--color-gray-light);
  color: var(--color-black);
  -webkit-tap-highlight-color: transparent;
}

/* App layout */
body {
  display: flex;
  flex-direction: column;
}

.app-header {
  height: var(--header-height);
  background-color: var(--color-primary);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 10;
}

.app-title {
  font-size: 20px;
  font-weight: 700;
}

.user-greeting {
  font-size: 14px;
  opacity: 0.9;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen-container {
  padding: 16px;
  min-height: 100%;
}

/* Bottom nav */
.bottom-nav {
  height: calc(var(--nav-height) + var(--safe-area-bottom));
  padding-bottom: var(--safe-area-bottom);
  background-color: var(--color-white);
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  color: var(--color-black);
  opacity: 0.6;
  transition: opacity 0.2s;
  font-size: 12px;
  font-family: var(--font-family);
}

.nav-item.active {
  color: var(--color-primary);
  opacity: 1;
  font-weight: 600;
}

.nav-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

.nav-label {
  font-size: 11px;
}

/* General UI elements */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target-min);
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}
button:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-white);
}
.btn-accent {
  background-color: var(--color-accent);
  color: var(--color-white);
}
.btn-gold {
  background-color: var(--color-gold);
  color: var(--color-black);
}

/* Cards */
.card {
  background: var(--color-white);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Skeleton loader */
.loading-skeleton {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  color: #999;
}

/* Toast container */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: var(--color-white);
  font-size: 14px;
  font-weight: 500;
  background: var(--color-black);
  pointer-events: auto;
  animation: slideDown 0.3s ease-out;
}
.toast.error {
  background: var(--color-error);
}
.toast.success {
  background: var(--color-success);
}
@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Offline banner */
.offline-banner {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--color-black);
  color: var(--color-white);
  text-align: center;
  padding: 8px;
  font-size: 13px;
  z-index: 999;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Onboarding cards */
.onboarding-card {
  max-width: 400px;
  margin: 0 auto;
}


/* Explore */
.explore-header {
  margin-bottom: 16px;
}
.search-bar {
  background: var(--color-white);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
.date-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.date-input, .text-input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-family);
}
.date-separator {
  color: #666;
  font-size: 14px;
}
.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.chip {
  padding: 8px 16px;
  border: 1px solid var(--color-accent);
  border-radius: 20px;
  background: transparent;
  color: var(--color-accent);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.2s;
}
.chip-active {
  background: var(--color-accent);
  color: var(--color-white);
}

/* Vehicle list */
.vehicle-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.vehicle-card {
  background: var(--color-white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  cursor: pointer;
}
.card-image {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.availability-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-available {
  background: var(--color-accent);
  color: var(--color-white);
}
.badge-booked {
  background: #999;
  color: #fff;
}
.card-body {
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.card-info {
  flex: 1;
  min-width: 0;            /* allows text to truncate if needed */
}

.card-model {
  font-size: 16px;
  color: var(--color-black);
  margin-bottom: 4px;
}
.card-company {
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
}
.card-rate {
  font-size: 16px;
  color: var(--color-gold);
  font-weight: 700;
}
.rate-period {
  font-size: 12px;
  font-weight: 400;
  color: #666;
  margin-left: 4px;
}

/* Vehicle detail */
.vehicle-detail {
  padding-bottom: 80px; /* space for sticky button */
}
.photo-gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  height: 240px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.gallery-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
}

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;   /* was cover */
  background: #000;      /* dark background for letterboxed images */
}

.gallery-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  cursor: pointer;
}
.dot-active {
  background: var(--color-accent);
}
.detail-body {
  padding: 0 8px;
}
.model-title {
  font-size: 20px;
  color: var(--color-primary);
  margin-bottom: 4px;
}
.company-name {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}
.rate {
  font-size: 18px;
  color: var(--color-gold);
  font-weight: 700;
  margin-bottom: 12px;
}
.description {
  font-size: 14px;
  color: var(--color-black);
  margin-bottom: 16px;
  line-height: 1.5;
}
.add-ons h4 {
  margin-bottom: 6px;
  color: var(--color-primary);
}
.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.pill {
  padding: 6px 12px;
  border: 1px solid var(--color-gold);
  border-radius: 16px;
  font-size: 13px;
  color: var(--color-gold);
}
.map-container {
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
}
.map-placeholder {
  background: var(--color-gray-light);
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}
.sticky-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--color-white);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  z-index: 10;
}
.sticky-bottom .btn {
  width: 100%;
}

/* Empty & error states */
.empty-state, .error-state {
  text-align: center;
  padding: 32px 16px;
  color: #666;
}
.error-state button {
  margin-top: 12px;
}

/* Loading skeleton override */
.loading-skeleton {
  text-align: center;
  padding: 32px;
}

/* Mini gallery (vehicle cards) */
.gallery-mini {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  height: 180px;         /* keep fixed height */
  position: relative;
}
.gallery-slide-mini {
  flex: 0 0 100%;
  scroll-snap-align: start;
}
.gallery-slide-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;     /* card image can be cover – keep compact */
}
.gallery-dots-mini {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 0;
}
.dot-mini {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ccc;
  cursor: pointer;
}
.dot-mini.dot-active {
  background: var(--color-accent);
}

@media (min-width: 600px) {
  .gallery-slide-mini img {
    object-fit: contain;
    background: #000;
  }
}


/* ── Branded horizontal scrollbar ─────────────────────── */

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #0A2A5E #F4F4F4;
}

/* WebKit (Chrome, Safari, Android) */
::-webkit-scrollbar {
  height: 6px;                /* thin horizontal bar */
}

::-webkit-scrollbar-track {
  background: #F4F4F4;        /* light gray track */
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #0A2A5E;        /* Deep Blue thumb */
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #F47920;        /* Orange on hover */
}

.company-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.company-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-primary);
}
.company-location {
  font-size: 13px;
  color: #666;
  margin: 0;
}
.section {
  margin-bottom: 16px;
}
.section h4 {
  margin-bottom: 6px;
  color: var(--color-primary);
  font-size: 14px;
}
.description {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-black);
}

/* Details button on cards */
.details-btn {
  flex-shrink: 0;
  width: auto;
  margin-top: 0;
  background: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}


.details-btn:active {
  background: var(--color-primary);
  color: var(--color-white);
}

/* Detail page sections */
.detail-section {
  margin-bottom: 20px;
}
.detail-section h4 {
  font-size: 14px;
  color: var(--color-primary);
  margin-bottom: 6px;
}


/* Sticky bottom bar with two buttons */
.sticky-bottom {
  display: flex;
  gap: 12px;
}
.sticky-bottom .btn-outline {
  flex: 1;
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}
.sticky-bottom .btn-accent {
  flex: 2;
}

.card-detail {
  padding: 12px 12px 0;
  border-top: 1px solid var(--color-gray-light);
  margin-top: 8px;
}
.card-detail.hidden {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.hidden {
  display: none;
}
.modal-content {
  background: var(--color-white);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.modal-content h3 {
  margin-bottom: 16px;
  color: var(--color-primary);
}
.modal-field {
  margin-bottom: 12px;
}
.modal-field label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--color-black);
}
.modal-input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-family);
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.modal-actions .btn {
  flex: 1;
}
.modal-error {
  color: var(--color-error);
  font-size: 13px;
  margin-top: 8px;
}
.modal-error.hidden {
  display: none;
}

/* Trips screen */
.section-title {
  font-size: 18px;
  color: var(--color-primary);
  margin: 16px 0 8px;
}
.booking-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.booking-card {
  display: block;
  overflow: visible;
}

.booking-card-body {
  flex: 1;
}
.booking-model {
  font-size: 16px;
  font-weight: 600;
}
.booking-company, .booking-dates {
  font-size: 13px;
  color: #666;
}
.booking-price {
  font-size: 16px;
  color: var(--color-gold);
  font-weight: 700;
  margin: 4px 0;
}
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}
.status-reserved { background: var(--color-accent); color: #fff; }
.status-checked_out { background: var(--color-primary); color: #fff; }
.status-cancelled { background: #999; color: #fff; }
.status-checked_in { background: var(--color-success); color: #fff; }

.booking-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cancel-btn {
  margin-left: 8px;
}

/* Countdown timer */
.countdown-timer {
  font-size: 14px;
  color: var(--color-error);
  font-weight: 600;
  margin-top: 4px;
}

/* SOS button */
.sos-btn {
  background: var(--color-error);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-left: 4px;
  width: auto;
}
.sos-btn:active {
  background: #b71c1c;
}

/* SOS confirmation screen (no extra classes needed; inline styles used) */

/* Accept & Invoice buttons re-use existing .btn-accent and .btn-outline */

/* SOS overlay (non‑blocking) */
.sos-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
}
.sos-overlay-card {
  background: var(--color-white);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}
.sos-overlay-card h3 {
  color: var(--color-primary);
  margin-bottom: 8px;
}
.sos-overlay-card p {
  color: #555;
  margin-bottom: 20px;
  font-size: 14px;
}
.sos-overlay-card .btn-accent {
  width: 100%;
}

/* Deals screen */
.section-title {
  font-size: 18px;
  color: var(--color-primary);
  margin: 16px 0 8px;
}
.deals-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.deal-card {
  position: relative;
  overflow: hidden;
}
.deal-card-image {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}
.deal-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.deal-discount-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--color-gold);
  color: var(--color-black);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}
.deal-discount-badge.expired {
  background: #999;
  color: #fff;
}
.deal-card-body {
  padding: 12px;
}
.deal-company {
  font-size: 12px;
  color: #666;
  margin-bottom: 2px;
}
.deal-model {
  font-size: 16px;
  color: var(--color-black);
  margin-bottom: 6px;
}
.deal-pricing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.deal-original {
  text-decoration: line-through;
  color: #999;
  font-size: 13px;
}
.deal-discounted {
  color: var(--color-gold);
  font-weight: 700;
  font-size: 16px;
}
.deal-expiry {
  font-size: 12px;
  color: var(--color-error);
  margin-bottom: 8px;
}
.deal-detail {
  padding-top: 8px;
  border-top: 1px solid var(--color-gray-light);
}
.deal-detail.hidden {
  display: none;
}
.deal-description {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
}
.deal-location, .deal-terms {
  font-size: 13px;
  color: #555;
  margin-bottom: 4px;
}
.grab-btn {
  margin-top: 8px;
  width: 100%;
}
.grab-success {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--color-gold);
  font-weight: 600;
  margin-top: 8px;
}
.grab-success.hidden {
  display: none;
}
.deal-card-toggle {
  padding: 0 12px 12px;
}
.deal-card-toggle .btn-outline {
  width: 100%;
}
.empty-sub {
  font-size: 13px;
  color: #999;
  margin-top: 4px;
}

.like-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.35);
  border: none;
  border-radius: 20px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.like-btn svg {
  width: 20px;
  height: 20px;
  transition: fill 0.2s, stroke 0.2s;
}
.like-count {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.like-btn.liked .like-count {
  color: #FF6B6B;
}

.share-btn {
  position: absolute;
  top: 8px;
  left: 60px;          /* sits to the right of the like button; adjust if needed */
  background: rgba(0,0,0,0.35);
  border: none;
  border-radius: 20px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

/* Inspections & Receipts sections */
.card-section {
  padding: 0 12px 12px;
}
.toggle-inspections-btn {
  width: 100%;
  margin-top: 8px;
}
.inspections-container {
  margin-top: 8px;
}
.inspections-container.hidden {
  display: none;
}
.inspection-card {
  background: var(--color-gray-light);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}
.inspection-card h4 {
  margin-bottom: 6px;
  color: var(--color-primary);
  font-size: 14px;
}
.inspection-card p {
  font-size: 13px;
  margin-bottom: 4px;
}
.inspection-photos {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 6px;
}
.inspection-photos img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
}
.hash {
  font-size: 11px;
  color: #999;
  margin-top: 6px;
}
.loading-text {
  color: #666;
  font-size: 13px;
  text-align: center;
  padding: 8px;
}

/* Collection actions */
.collection-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.collection-note {
  font-size: 13px;
  color: #555;
  margin-top: 8px;
  font-style: italic;
}

.modal-dialog-wide {
  max-width: 90vw;
  width: 90vw;
  min-height: 40vh;
  border-radius: 16px;
}

/* Recently Viewed strip */
.recent-row {
  margin-bottom: 12px;
}
.recent-row.hidden {
  display: none;
}
.recent-row h4 {
  font-size: 14px;
  color: var(--color-primary);
  margin-bottom: 6px;
}
.recent-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.recent-thumb {
  flex: 0 0 100px;
  background: var(--color-white);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  cursor: pointer;
  text-align: center;
}
.recent-thumb img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
}
.recent-model {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  color: var(--color-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-price {
  display: block;
  font-size: 11px;
  color: var(--color-gold);
  font-weight: 700;
}

/* Install banner */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-primary);
  color: var(--color-white);
  z-index: 1500;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}
.install-banner.hidden {
  display: none;
}
.install-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}
.install-banner-icon {
  flex-shrink: 0;
  color: var(--color-gold);
}
.install-banner-text {
  flex: 1;
}
.install-banner-text h4 {
  font-size: 15px;
  margin: 0 0 2px;
  color: var(--color-white);
}
.install-banner-text p {
  font-size: 12px;
  margin: 0;
  opacity: 0.9;
}
.install-btn {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 16px;
}
.install-close-btn {
  background: transparent;
  border: none;
  color: var(--color-white);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
}
.install-close-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

