/* ============================================================
   ROUTE AI — SIDEBAR STYLES
   ============================================================ */

/* --- Sidebar Shell --- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 700;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
}

/* --- Sidebar Header --- */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.sidebar-logo-mark {
  width: 64px;
  height: 40px;
  filter: none;
  flex-shrink: 0;
}
.sidebar-logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-name {
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: none;
  color: var(--text-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: currentColor;
  background-clip: text;
}

.logo-sub {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-top: 2px;
}

.logo-sub2 {
  font-family: 'Dancing Script', cursive;
  text-transform: none;
  /* Cursive rarely looks good in ALL CAPS */
  font-size: 0.8rem;
  /* Cursive usually needs to be slightly larger to be readable */
}


/* --- Sidebar Scroll Area --- */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 2rem;
}

/* --- Sidebar Section --- */
.sidebar-section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child {
  border-bottom: none;
}

/* ============================================================
   SEARCH / LOCATION INPUTS
   ============================================================ */
.search-section {
  padding: 1.25rem 1.25rem 1rem;
}

.location-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Colored dot indicator */
.field-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.origin-dot {
  background: rgba(16, 185, 129, 0.12);
  border: 2px solid var(--success);
}

.destination-dot {
  background: rgba(239, 68, 68, 0.12);
  border: 2px solid #ef4444;
}

.dot-inner {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.origin-dot .dot-inner {
  background: var(--success);
}

.destination-dot .dot-inner {
  background: #ef4444;
}

.field-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.location-input {
  width: 100%;
  padding: 0.625rem 2.25rem 0.625rem 0.875rem;
  background: var(--glass);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), background var(--dur-base);
}

.location-input::placeholder {
  color: var(--text-4);
}

.location-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: var(--glass-hover);
}

.pick-map-btn {
  position: absolute;
  right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: color var(--dur-fast), background var(--dur-fast);
}

.pick-map-btn:hover {
  color: var(--primary-light);
  background: var(--glass-hover);
}

/* Connector between origin and destination */
.route-connector {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0 0.375rem 0.5rem;
  margin-left: 0.25rem;
}

.connector-dots {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-left: 3px;
}

.connector-dots span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-4);
}

.swap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  background: var(--glass);
  border: 1px solid var(--border-light);
  color: var(--text-2);
  transition: all var(--dur-base) var(--ease);
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 0.25rem;
}

.swap-btn:hover {
  background: var(--glass-hover);
  border-color: var(--primary);
  color: var(--primary-light);
  transform: rotate(180deg);
}

/* ============================================================
   TRAVEL MODE TABS
   ============================================================ */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.375rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0.3125rem;
}

.mode-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem 0.25rem;
  border-radius: var(--r-md);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  transition: all var(--dur-base) var(--ease);
}

.mode-tab:hover {
  color: var(--text-2);
  background: var(--glass);
}

.mode-tab.active {
  background: var(--bg-raised);
  border: 1px solid rgba(37, 99, 235, 0.5);
  color: var(--text-1);
}
.mode-tab.active svg { color: var(--primary); }

/* ============================================================
   ROUTE OPTIONS
   ============================================================ */
.options-section {
  padding: 0.875rem 1.25rem;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}

.toggle-row:hover {
  background: var(--glass-hover);
  border-color: var(--border-light);
}

.toggle-label-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
}

.toggle-icon {
  font-size: 0.875rem;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  display: block;
  width: 36px;
  height: 20px;
  background: #374151;
  border: 1px solid var(--border-light);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background var(--dur-base) var(--ease), border-color var(--dur-base);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform var(--dur-base) var(--ease-bounce), background var(--dur-base);
}

.toggle-switch input:checked+.toggle-track {
  background: var(--primary);
  border-color: var(--primary);
}

.toggle-switch input:checked+.toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: #ffffff;
}

/* ============================================================
   CALCULATE BUTTON
   ============================================================ */
.calculate-btn {
  position: relative;
  width: 100%;
  padding: 0.875rem 1.25rem;
  background: var(--primary);
  border-radius: var(--r-lg);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 600;
  overflow: hidden;
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
  animation: gradientShift 6s ease infinite;
  background-size: 200% 200%;
}

.calculate-btn:hover {
  transform: translateY(-2px);
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.calculate-btn:active {
  transform: translateY(0);
}

.calculate-btn.is-start {
  background: #2563eb;
  font-weight: 700;
}

.calculate-btn.is-start:hover {
  background: #1d4ed8;
}

.calculate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.calculate-btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  position: relative;
  z-index: 1;
}

.calculate-btn-glow {
  position: absolute;
  inset: 0;
  background: transparent;
  opacity: 0;
  transition: opacity var(--dur-base);
  pointer-events: none;
}

.calculate-btn:hover .calculate-btn-glow {
  opacity: 1;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.5rem;
  text-align: center;
  gap: 0.875rem;
}

.empty-icon {
  opacity: 0.7;
  animation: pulse 3s ease-in-out infinite;
}

.empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
}

.empty-desc {
  font-size: 0.8125rem;
  color: var(--text-3);
  line-height: 1.6;
  max-width: 260px;
}

/* ============================================================
   RESULTS SECTION
   ============================================================ */
.results-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem 0.625rem;
}

.results-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-1);
}

.results-title-row svg {
  color: var(--primary);
}

.traffic-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--r-full);
}

.traffic-badge.clear {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.traffic-badge.slow {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.traffic-badge.heavy {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

/* --- Route Cards --- */
.route-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1.25rem 0.5rem;
}

.route-card {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease), border-color var(--dur-base), transform var(--dur-base);
  animation: routeCardIn 0.4s var(--ease-bounce) both;
  overflow: hidden;
}

.route-card:hover {
  background: var(--glass-hover);
  border-color: var(--border-light);
  transform: translateX(2px);
}

.route-card.selected {
  background: var(--glass-active);
  border-color: rgba(37, 99, 235, 0.5);
}

.route-card.selected.green {
  background: var(--glass-active);
  border-color: rgba(37, 99, 235, 0.5);
}

.route-card.selected.amber {
  background: var(--glass-active);
  border-color: rgba(37, 99, 235, 0.5);
}

/* Color accent bar */
.route-card-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--r-xs) 0 0 var(--r-xs);
}

.route-card-bar.blue {
  background: var(--route-a);
}

.route-card-bar.green {
  background: var(--route-b);
}

.route-card-bar.amber {
  background: var(--route-c);
}

/* Card Header */
.route-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.route-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.route-label-icon {
  font-size: 0.875rem;
}

.route-label-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-1);
}

.route-label-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: var(--r-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag-fastest {
  background: #1e293b;
  color: #94a3b8;
}

.tag-eco {
  background: #1e293b;
  color: #94a3b8;
}

.tag-alt {
  background: #1e293b;
  color: #94a3b8;
}

.tag-best {
  background: #1e293b;
  color: #94a3b8;
}

/* ETA (big number) */
.route-eta {
  text-align: right;
}

.route-eta-value {
  font-size: 1.4375rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-1);
  letter-spacing: -0.03em;
}

.route-eta-unit {
  font-size: 0.7rem;
  color: var(--text-3);
  font-weight: 500;
}

/* Card Stats Row */
.route-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.route-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-2);
}

.route-stat-icon {
  opacity: 0.7;
}

.stat-divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-4);
}

/* Traffic delay indicator */
.route-traffic {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.5rem;
  font-size: 0.7375rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--r-sm);
}

.route-traffic.no-delay {
  background: var(--success-bg);
  color: var(--success);
}

.route-traffic.some-delay {
  background: var(--warning-bg);
  color: var(--warning);
}

.route-traffic.heavy-delay {
  background: var(--danger-bg);
  color: var(--danger);
}

.select-indicator {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-base);
}

.route-card.selected .select-indicator {
  background: var(--primary);
  border-color: var(--primary);
}

.select-indicator svg {
  opacity: 0;
  transition: opacity var(--dur-fast);
}

.route-card.selected .select-indicator svg {
  opacity: 1;
}

/* ============================================================
   AI ANALYSIS PANEL
   ============================================================ */
.ai-panel {
  padding: 0.75rem 1.25rem 1.25rem;
}

.ai-analyze-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text-1);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--dur-base) var(--ease);
  overflow: hidden;
}

.ai-analyze-btn:hover {
  background: var(--glass-hover);
  border-color: var(--border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.ai-analyze-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ai-btn-sparkle {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
  animation: sparkle 4s ease infinite;
}

.ai-badge-pill {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  background: #1e293b;
  background-size: 200%;
  animation: gradientShift 3s ease infinite;
  border-radius: var(--r-full);
  color: #94a3b8;
  letter-spacing: 0.03em;
}

/* AI Result Box */
.ai-result-box {
  margin-top: 0.75rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  animation: fadeInUp 0.35s var(--ease) both;
}

.ai-result-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}

.ai-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.ai-res-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-1);
}

.ai-res-sub {
  font-size: 0.7rem;
  color: var(--text-3);
}

.ai-close-btn {
  margin-left: auto;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 0.7rem;
  transition: all var(--dur-fast);
}

.ai-close-btn:hover {
  background: var(--glass-hover);
  color: var(--text-1);
}

.ai-result-content {
  padding: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-2);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(62vh, 560px);
  overflow-y: auto;
}

.ai-brief-row {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.ai-brief-row:last-child { border-bottom: 0; }

.ai-brief-route {
  padding: 0.7rem;
  border-radius: var(--r-sm);
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--text-1);
}

.ai-brief-label {
  color: var(--text-3);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ai-brief-detail { font-weight: 500; }
.ai-brief-route .ai-brief-detail { font-size: 0.95rem; font-weight: 700; }
.ai-brief-insight {
  margin-top: 0.25rem;
  border-radius: var(--r-sm);
  background: rgba(59, 130, 246, 0.08);
}
.ai-brief-watch .ai-brief-label { color: #fbbf24; }
.ai-brief-next .ai-brief-detail { color: var(--text-1); font-weight: 650; }

.ai-result-content p {
  margin-bottom: 0.5rem;
}

.ai-result-content p:last-child {
  margin-bottom: 0;
}

/* Responsive shell and snap states are defined in layout.css. */

/* ============================================================
   BADGE VARIANTS
   ============================================================ */
.badge-cyan {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid var(--border);
}

/* ============================================================
   MET MALAYSIA WEATHER PANEL
   ============================================================ */
.weather-panel {
  margin: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  animation: fadeInDown 0.3s var(--ease) both;
}

.weather-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.weather-panel-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.weather-panel-icon {
  font-size: 1.25rem;
  filter: none;
  animation: weatherPulse 2.5s ease-in-out infinite;
}

.weather-panel-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

.weather-panel-sub {
  font-size: 0.68rem;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 1px;
}

.weather-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 0.8rem;
  transition: color var(--dur-fast), background var(--dur-fast);
}

.weather-close-btn:hover {
  color: var(--text-1);
  background: var(--glass-hover);
}

/* Section blocks */
.weather-block {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.weather-block:last-child {
  border-bottom: none;
}

.weather-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 0.625rem;
}

/* Loading / OK states */
.weather-loading {
  font-size: 0.78rem;
  color: var(--text-3);
  padding: 0.5rem 0;
  animation: pulse 1.5s ease-in-out infinite;
}

.weather-ok {
  font-size: 0.8rem;
  color: var(--text-2);
  padding: 0.375rem 0;
}

/* Storm Warning Cards */
.weather-warnings-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}

.weather-warn-card {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--r-md);
  padding: 0.625rem 0.75rem;
  animation: fadeInDown 0.25s var(--ease) both;
}

.weather-warn-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f59e0b;
  margin-bottom: 4px;
}

.weather-warn-desc {
  font-size: 0.72rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 4px;
}

.weather-warn-until {
  font-size: 0.7rem;
  color: #f59e0b;
  font-weight: 600;
}

/* Rain Area Cards */
.weather-rain-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  max-height: 260px;
  overflow-y: auto;
}

.weather-rain-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 0.78rem;
  animation: fadeInDown 0.2s var(--ease) both;
  transition: background var(--dur-fast);
}

.weather-rain-card:hover {
  filter: brightness(1.08);
}

.rain-storm {
  background: rgba(245, 158, 11, 0.07);
  border-color: rgba(245, 158, 11, 0.22);
}

.rain-rain {
  background: var(--bg-raised);
  border-color: var(--border);
}

.rain-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.rain-loc {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-1);
}

.rain-when {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 1px;
}

.weather-more {
  font-size: 0.72rem;
  color: var(--text-3);
  text-align: center;
  padding: 0.25rem;
  font-style: italic;
}

/* Weather Panel Footer */
.weather-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.25rem 0.75rem;
  font-size: 0.68rem;
  color: var(--text-4);
}

/* ── Keyframe: weather marker pulse ──────────────────────── */
@keyframes weatherPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.08);
    opacity: 0.85;
  }
}

@keyframes weatherWarnPulse {

  0%,
  100% {
    box-shadow: var(--shadow-sm);
  }

  50% {
    box-shadow: var(--shadow-sm);
  }
}
