/* ==============================================================================
 * One Maps - UI & Dedicated Management Modal Windows
 * ============================================================================== */

:root {
  --bg-primary: #f8f9fa;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f3f4;
  --accent: #1a73e8;
  --accent-hover: #1557b0;
  --accent-gradient: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
  --accent-green: #1e8e3e;
  --accent-orange: #e37400;
  --accent-yellow: #f9ab00;
  --accent-purple: #a142f4;
  --accent-pink: #e91e63;
  --text-main: #202124;
  --text-muted: #5f6368;
  --border-color: #dadce0;
  --shadow: 0 2px 6px rgba(60, 64, 67, 0.25), 0 1px 2px rgba(60, 64, 67, 0.3);
  --shadow-lg: 0 8px 24px rgba(60, 64, 67, 0.3);
  --font-family: 'Google Sans', 'Inter', -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg-primary: #171717;
  --bg-surface: #242424;
  --bg-surface-hover: #303134;
  --accent: #8ab4f8;
  --accent-hover: #aecbfa;
  --accent-gradient: linear-gradient(135deg, #8ab4f8 0%, #669df6 100%);
  --accent-green: #81c995;
  --accent-orange: #fcad70;
  --accent-yellow: #fde293;
  --accent-purple: #c58af9;
  --accent-pink: #f48fb1;
  --text-main: #e8eaed;
  --text-muted: #9aa0a6;
  --border-color: #3c4043;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.75);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

.top-search-floating {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.top-search-floating > * {
  pointer-events: auto;
}

.search-card-google {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  padding: 6px 14px 6px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  width: 390px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.search-card-google:focus-within {
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.search-input-google {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-main);
  font-size: 0.92rem;
  width: 100%;
  font-family: inherit;
}

.google-pills-ribbon {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.google-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.google-pill:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.sidebar-expandable {
  position: absolute;
  top: 76px;
  left: 16px;
  bottom: 24px;
  width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  z-index: 90;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  overflow: hidden;
}

.sidebar-expandable.collapsed {
  transform: translateX(-450px);
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  padding: 16px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-close-panel {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-close-panel:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-mode-switch {
  display: flex;
  background: var(--bg-primary);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  gap: 4px;
}

.mode-tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.mode-tab-btn.active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.sub-panel-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.sub-tab-chip {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.sub-tab-chip.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.delivery-search-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.delivery-search-input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-main);
  font-size: 0.88rem;
  width: 100%;
  font-family: inherit;
}

/* BRAND HEADER */
.brand-header-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
}

.brand-logo-img {
  width: 42px;
  height: 42px;
}

.brand-name-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-tagline {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.user-profile-card {
  padding: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-avatar-box {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.user-name-text {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.user-sub-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.user-member-badge {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(249, 171, 0, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(249, 171, 0, 0.3);
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 4px;
}

/* Interactive Card Buttons that open Dedicated Modals */
.profile-modal-trigger-card {
  padding: 14px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-modal-trigger-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

/* Dedicated Popup Window Overlay */
.management-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

.management-modal-window {
  width: 520px;
  max-width: 90vw;
  max-height: 85vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-window-header {
  padding: 18px 22px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-window-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-window-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-window-footer {
  padding: 14px 22px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.form-input-sm {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
}

.form-input-sm:focus {
  border-color: var(--accent);
}

.agent-toggle-box {
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(30, 142, 62, 0.08) 0%, rgba(52, 168, 83, 0.08) 100%);
  border: 1px solid rgba(30, 142, 62, 0.3);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: #ccc;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-switch.active {
  background: var(--accent-green);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch.active .toggle-knob {
  transform: translateX(20px);
}

.google-layers-box {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 50;
  width: 76px;
  height: 76px;
  border-radius: 12px;
  border: 2px solid #ffffff;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  overflow: hidden;
  background: url('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/6/29/44') center/cover no-repeat;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.google-layers-box:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.google-layers-label {
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  width: 100%;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 0;
  backdrop-filter: blur(4px);
}

.vehicle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vehicle-card {
  padding: 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vehicle-card:hover {
  border-color: var(--accent);
  background: var(--bg-surface-hover);
}

.vehicle-card.selected {
  border-color: var(--accent);
  background: rgba(26, 115, 232, 0.08);
  box-shadow: 0 0 0 2px var(--accent);
}

.vehicle-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vehicle-icon {
  width: 44px;
  height: 44px;
  background: var(--bg-surface);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.vehicle-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.vehicle-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.fare-amount {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 24px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.results-list {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  z-index: 120;
}

.result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s;
}

.result-item:hover {
  background: var(--bg-surface-hover);
}

.booking-modal {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translate(-50%, 100px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

#map {
  width: 100vw;
  height: 100vh;
}

/* Sticky & Fixed Confirm Order Tote */
#btn-book-ride {
  position: sticky;
  bottom: 0;
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
}

/* Mobile & Tablet Responsiveness for One Maps App UI */
@media (max-width: 768px) {
  .top-search-floating {
    flex-direction: column;
    align-items: stretch;
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 8px;
  }

  .search-card-google {
    width: 100%;
  }

  .sidebar-expandable {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 65vh;
    max-height: 65vh;
    border-radius: 24px 24px 0 0;
    padding-bottom: 70px; /* Space for fixed confirm order tote */
  }

  .sidebar-expandable.collapsed {
    transform: translateY(100%);
  }

  /* Layers box with lower z-index (50) than confirm order tote */
  .google-layers-box {
    top: 135px;
    right: 14px;
    bottom: auto;
    left: auto;
    width: 54px;
    height: 54px;
    z-index: 50;
  }

  /* Fixed Floating Confirm Order Tote for Mobile (z-index 120 > 50) */
  #btn-book-ride {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    width: calc(100% - 32px);
    z-index: 120;
    padding: 14px;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
    border-radius: 28px;
  }

  .sidebar-expandable.collapsed ~ #btn-book-ride {
    display: none;
  }

  .booking-modal {
    width: calc(100% - 24px);
    bottom: 12px;
    z-index: 200;
  }

  .management-modal-window {
    width: 95vw;
    max-height: 90vh;
    border-radius: 20px;
  }
}
