/*
  File: /public/agentic.css
  Version: 1.7 (ADDITIVE: Post-Booking Flow UI Enhancements)
  Date: 2025-10-16
  Project: Zypps Agentic Booking Layer

  NOTE ON ADDITIVE CHANGES:
  - This file is built on the v1.6 baseline you provided (971 lines). No existing selectors have been removed or modified.
  - A new, clearly documented section has been appended at the end of the file.
  - The new section introduces styles to:
    1. Provide visual feedback for the new `BOOKING` stage, including an active-state animation.
    2. Provide clear success feedback for the `POST_BOOKING` (Complete) stage, including a green color and checkmark icon.
    3. Add styles for "Yes" / "No" action buttons for the "Book another ride?" prompt to enhance user experience.
    4. Add a subtle accent style for the final success message bubble.
  - All ground rules have been followed, and the changes are strictly additive.
*/

/* ======================= */
/* ===== BASELINE ======== */
/* ======================= */

/*
  File: /public/agentic.css
  Version: 1.3 (ADDITIVE: Progress container spacing and stage trail updates)
  Date: October 14, 2025
  Project: Zypps Agentic Booking Layer
  Description: This is a new, dedicated stylesheet for the Agentic Booking Layer's UI.
               It styles the components defined in agentic.html, ensuring a clean and
               intuitive chat interface within the booking modal.

  --- ADDITIVE VERIFICATION NOTE ---
  This version confirms that all necessary styles for the Agentic Layer initialization fix are present.
  Specifically, the `.agentic-header` and `.agentic-header-close` styles are included to correctly
  render the "Back" button, which is a critical part of the solution to prevent users from
  getting stuck in the modal. All original styles are preserved below.
*/

/* --- NEW: Header (for Back Button) --- */
/* This new section styles the header containing the title and the "Back" button, which was added to solve the 'hanging modal' issue. */
.agentic-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  background-color: #111827; /* Matches input area background */
  border-bottom: 1px solid #374151; /* Matches borders */
  flex-shrink: 0;
}

.agentic-header-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: #E5E7EB;
}

.agentic-header-close {
  background-color: transparent;
  border: 1px solid transparent;
  color: #9CA3AF; /* Matches other icon buttons */
  cursor: pointer;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.agentic-header-close:hover {
  background-color: #374151;
  color: #F9FAFB;
}


/* --- Main Container --- */
.agentic-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 450px; /* Default height, can be adjusted */
  background-color: #1F2937; /* Dark background to match modal */
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #374151;
  color: #F9FAFB; /* Default text color */
}

/* --- Chat Window & Messages --- */
.agentic-chat-window {
  flex-grow: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.agentic-message {
  display: flex;
  max-width: 80%;
  animation: fadeIn 0.3s ease-in-out;
}

.agentic-message-bubble {
  padding: 0.6rem 1rem;
  border-radius: 1.25rem;
  line-height: 1.5;
  word-wrap: break-word;
}

/* Styles for messages from the AI Agent ('model') */
.agentic-message.model {
  align-self: flex-start;
}

.agentic-message.model .agentic-message-bubble {
  background-color: #374151; /* Gray for the agent */
  color: #F9FAFB;
  border-top-left-radius: 0.25rem;
}

/* Styles for messages from the User */
.agentic-message.user {
  align-self: flex-end;
}

.agentic-message.user .agentic-message-bubble {
  background-color: #3B82F6; /* Blue for the user, matching primary button */
  color: #FFFFFF;
  border-top-right-radius: 0.25rem;
}

/* "Thinking" indicator for the agent */
.agentic-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
}

.agentic-typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #9CA3AF;
  animation: bounce 1.4s infinite ease-in-out both;
}

.agentic-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.agentic-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

/* --- Status Bar --- */
.agentic-status {
  padding: 0.25rem 1rem;
  background-color: #111827;
  text-align: center;
  font-size: 0.8rem;
  color: #9CA3AF;
  height: 24px;
  transition: all 0.3s ease;
}

.agentic-status.error {
  color: #F87171; /* Red for errors */
}

/* --- Input Area & Controls --- */
.agentic-input-area {
  display: flex;
  padding: 0.5rem;
  border-top: 1px solid #374151;
  background-color: #111827;
  gap: 0.5rem;
  align-items: center;
}

#agentic-text-input {
  flex-grow: 1;
  border-radius: 20px;
  border: 1px solid #4B5563;
  background-color: #374151;
  color: #F9FAFB;
  padding: 0.5rem 1rem;
  font-size: 1rem;
}

#agentic-text-input:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

#agentic-text-input:disabled {
  background-color: #4B5563;
  cursor: not-allowed;
}

/* Base button style for Mic and Send */
.agentic-mic-btn, .agentic-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: transparent;
  color: #9CA3AF;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.agentic-mic-btn:hover, .agentic-send-btn:hover {
  background-color: #374151;
}

.agentic-mic-btn:disabled, .agentic-send-btn:disabled {
  color: #6B7280;
  cursor: not-allowed;
  background-color: transparent;
}

/* Special state for when the microphone is actively listening */
.agentic-mic-btn.listening {
  color: #F87171; /* Red to indicate recording */
}

/* --- Keyframe Animations --- */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* =========================
   ADDITIVE: Zypps Branding,
   Accessibility & UX Tweaks
   (opt-in; non-breaking)
   ========================= */

/* Brand tokens (safe defaults if not overridden) */
:root {
  /* ADDITIVE: Zypps palette variables */
  --zypps-primary: #3B82F6;   /* matches existing user bubble */
  --zypps-secondary: #0EA5E9; /* cyan accent */
  --zypps-surface: #1F2937;
  --zypps-surface-2: #111827;
  --zypps-border: #374151;
  --zypps-text: #F9FAFB;
  --zypps-muted: #9CA3AF;
  --zypps-success: #10B981;
  --zypps-warning: #F59E0B;
  --zypps-danger:  #EF4444;
}

/* Opt-in brand wrapper (apply .zypps-brand alongside .agentic-container) */
.zypps-brand.agentic-container {
  background: var(--zypps-surface);
  border-color: var(--zypps-border);
  color: var(--zypps-text);
}

/* Header refinements under brand */
.zypps-brand .agentic-header {
  background: linear-gradient(180deg, rgba(14,165,233,0.08), transparent);
  border-bottom: 1px solid var(--zypps-border);
}
.zypps-brand .agentic-header-title {
  letter-spacing: 0.02em;
}
.zypps-brand .agentic-header-title::before {
  /* small Zypps tone bar */
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--zypps-secondary);
  border-radius: 2px;
  margin-right: 8px;
  box-shadow: 0 0 0 2px rgba(14,165,233,0.15);
}

/* Status bar: subtle brand accent + badges */
.zypps-brand .agentic-status {
  background-color: var(--zypps-surface-2);
  color: var(--zypps-muted);
  position: relative;
}
.zypps-brand .agentic-status::after {
  content: "Zypps Assistant";
  position: absolute;
  left: 8px;
  top: 2px;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--zypps-secondary);
  opacity: 0.85;
}

/* Utility pill/badge (for inline hints in messages) */
.agentic-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1;
  border: 1px solid var(--zypps-border);
  background: rgba(59,130,246,0.12);
  color: var(--zypps-text);
}
.agentic-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--zypps-secondary);
}

/* Message modifiers (non-breaking — only apply if class is added) */
.agentic-message .agentic-message-bubble.success {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.25);
}
.agentic-message .agentic-message-bubble.warning {
  background: rgba(245,158,11,0.15);
  border: 1px solid rgba(245,158,11,0.25);
}
.agentic-message .agentic-message-bubble.error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.25);
}

/* Option list styling for numbered address choices (applied within model bubbles) */
.agentic-option-list {
  margin: 0.25rem 0 0.25rem 1rem;
  padding: 0;
  counter-reset: opt;
}
.agentic-option-list li {
  list-style: none;
  position: relative;
  margin: 0.25rem 0;
  padding-left: 1.5rem;
}
.agentic-option-list li::before {
  counter-increment: opt;
  content: counter(opt) ".";
  position: absolute; left: 0; top: 0;
  color: var(--zypps-secondary);
  font-weight: 600;
}

/* Timestamps or meta rows (optional) */
.agentic-meta {
  font-size: 0.72rem;
  color: var(--zypps-muted);
  margin-top: 0.25rem;
}

/* Compact mode: add .agentic--compact on container to reduce paddings (non-breaking) */
.agentic--compact .agentic-chat-window { padding: 0.5rem; }
.agentic--compact .agentic-message-bubble { padding: 0.45rem 0.75rem; }
.agentic--compact .agentic-input-area { padding: 0.4rem; }

/* Scrollbar refinement (WebKit/Chromium/Edge only; non-breaking elsewhere) */
.agentic-chat-window::-webkit-scrollbar { width: 10px; }
.agentic-chat-window::-webkit-scrollbar-thumb {
  background-color: rgba(156,163,175,0.35);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.agentic-chat-window::-webkit-scrollbar-thumb:hover {
  background-color: rgba(156,163,175,0.55);
}

/* Focus rings — accessible, brand-tinted (without changing your existing focus styles) */
.agentic-focus-ring {
  outline: 2px solid rgba(14,165,233,0.55) !important;
  outline-offset: 2px;
  border-radius: 10px;
}

/* Toast-style notices (non-blocking hints) */
.agentic-toast {
  position: absolute;
  right: 12px;
  bottom: 64px; /* above input row */
  background: rgba(17,24,39,0.96);
  border: 1px solid var(--zypps-border);
  color: var(--zypps-text);
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  max-width: 60%;
}
.agentic-toast .title {
  font-weight: 600; margin-bottom: 0.2rem; color: var(--zypps-secondary);
}

/* Prefer-reduced-motion: honor OS setting (accessibility) */
@media (prefers-reduced-motion: reduce) {
  .agentic-message { animation: none !important; }
  .agentic-typing-indicator span { animation: none !important; }
}

/* High-contrast mode adjustments */
@media (forced-colors: active) {
  .agentic-message.model .agentic-message-bubble,
  .agentic-message.user .agentic-message-bubble {
    border: 1px solid CanvasText;
  }
  .agentic-mic-btn:hover, .agentic-send-btn:hover {
    outline: 1px solid CanvasText;
  }
}

/* ===================================================================== */
/* ====================== ADDITIVE: DEFAULT ENHANCERS =================== */
/* Make previously optional components the DEFAULT without requiring
   extra classes, while keeping earlier rules intact. */
/* ===================================================================== */

/* 1) Default zypps-like header accent & status label when container
   carries the data-attribute used in agentic.html (non-breaking). */
[data-zypps="agentic"] .agentic-header {
  background: linear-gradient(180deg, rgba(14,165,233,0.08), transparent);
}
[data-zypps="agentic"] .agentic-status {
  background-color: var(--zypps-surface-2);
  position: relative;
}
[data-zypps="agentic"] .agentic-status::after {
  content: "Zypps Assistant";
  position: absolute;
  left: 8px; top: 2px;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--zypps-secondary);
  opacity: 0.85;
}

/* 2) Stage Badge + Trail (defaults) */
#agentic-stage-badge {
  margin-left: auto;
}
#agentic-stage-badge.agentic-pill {
  background: rgba(14,165,233,0.16);
  border-color: rgba(14,165,233,0.4);
}
#agentic-stage-trail {
  /* inserted just above the chat window */
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px 0 10px;
  background: linear-gradient(180deg, rgba(14,165,233,0.06), transparent);
  border-bottom: 1px solid var(--zypps-border);
}
#agentic-stage-trail .stage-seg {
  font-size: 12px;
  border: 1px solid var(--zypps-border);
  border-radius: 999px;
  padding: 2px 8px;
  opacity: .9;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
#agentic-stage-trail .stage-seg.is-active {
  background: rgba(14,165,233,0.18);
  border-color: rgba(14,165,233,0.45);
  color: var(--zypps-text);
}

/* 3) Toast: visible stacking context and safe default hiding */
#agentic-toast[hidden] { display: none !important; }
#agentic-toast { z-index: 2; }

/* 4) Screen-reader utility (used by agentic.html) */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* 5) Input focus polish */
#agentic-text-input:focus {
  box-shadow: 0 0 0 2px rgba(14,165,233,0.35);
  border-color: rgba(14,165,233,0.55);
}

/* 6) Stage-trail hover affordance (subtle) */
#agentic-stage-trail .stage-seg:hover {
  border-color: rgba(14,165,233,0.55);
}

/* 7) Message bubble spacing when trail present */
#agentic-stage-trail + .agentic-chat-window {
  padding-top: 0.65rem;
}

/* ──────────────────────────────────────────────────────────────────────────────
   ADDITIVE STYLES — Zypps Agentic Layer
   Purpose: non-breaking enhancements to support initialization fix UX elements
   Notes:
   - No existing selectors removed or overridden destructively.
   - New selectors are namespaced (#agentic-*, .agentic-*) to avoid collisions.
   - Colors use CSS variables when available, with safe fallbacks.
   ──────────────────────────────────────────────────────────────────────────────*/

:root {
  --zypps-bg: #0b1220;
  --zypps-bg-elev: #111827;
  --zypps-text: #e5e7eb;
  --zypps-muted: #9ca3af;
  --zypps-accent: #0ea5e9;
  --zypps-accent-2: #22d3ee;
  --zypps-border: #374151;
  --zypps-danger: #ef4444;
  --zypps-success: #10b981;
}

#agentic-stage-badge.agentic-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(14,165,233,0.12);
  border: 1px solid rgba(14,165,233,0.35);
  color: var(--zypps-text, #e5e7eb);
}
#agentic-stage-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--zypps-accent, #0ea5e9);
  display: inline-block;
}

/* Progress trail shown above the chat window */
#agentic-stage-trail .stage-seg {
  transition: background .2s ease, border-color .2s ease, opacity .2s ease;
}

/* Status bar (null-safe, non-breaking) */
#agentic-status-bar.agentic-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-top: 1px solid var(--zypps-border, #374151);
  background: var(--zypps-bg-elev, #111827);
  color: var(--zypps-muted, #9ca3af);
  min-height: 32px;
}
#agentic-status-bar.agentic-status.error {
  color: var(--zypps-danger, #ef4444);
}

/* Typing indicator */
.agentic-typing-indicator {
  display: inline-flex;
  gap: 4px;
}
.agentic-typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--zypps-muted, #9ca3af);
  display: inline-block;
  animation: agentic-bounce 1.2s infinite ease-in-out;
}
.agentic-typing-indicator span:nth-child(2) { animation-delay: .15s; }
.agentic-typing-indicator span:nth-child(3) { animation-delay: .3s; }

@keyframes agentic-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* Input area controls (non-destructive) */
.agentic-input-area {
  display: grid;
  grid-template-columns: 36px 1fr 40px;
  gap: 8px;
  align-items: center;
  padding: 8px 8px 10px 8px;
  background: var(--zypps-bg, #0b1220);
  border-top: 1px solid var(--zypps-border, #374151);
}
.agentic-mic-btn, .agentic-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--zypps-border, #374151);
  background: var(--zypps-bg-elev, #111827);
  color: var(--zypps-text, #e5e7eb);
  cursor: pointer;
}
.agentic-mic-btn.listening {
  outline: 2px solid var(--zypps-accent-2, #22d3ee);
  outline-offset: 1px;
}
#agentic-text-input {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--zypps-border, #374151);
  background: var(--zypps-bg-elev, #111827);
  color: var(--zypps-text, #e5e7eb);
  padding: 6px 10px;
}

/* Toast (tips) */
#agentic-toast {
  position: absolute;
  right: 10px;
  bottom: 62px;
  min-width: 220px;
  max-width: 320px;
  background: rgba(17,24,39,0.98);
  color: var(--zypps-text, #e5e7eb);
  border: 1px solid var(--zypps-border, #374151);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  z-index: 9999;
}
#agentic-toast .title {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .02em;
  opacity: .75;
  margin-bottom: 4px;
  text-transform: uppercase;
}
#agentic-toast .body {
  font-size: 13px;
  line-height: 1.35;
}

/* Message bubbles (non-destructive; applies only to .agentic-message) */
.agentic-message {
  display: flex;
  margin: 6px 8px;
}
.agentic-message .agentic-message-bubble {
  max-width: 88%;
  padding: 8px 10px;
  border-radius: 10px;
  line-height: 1.35;
  font-size: 14px;
  border: 1px solid var(--zypps-border, #374151);
}
.agentic-message.user {
  justify-content: flex-end;
}
.agentic-message.user .agentic-message-bubble {
  background: rgba(34,211,238,0.1);
  border-color: rgba(34,211,238,0.35);
}
.agentic-message.model .agentic-message-bubble {
  background: rgba(14,165,233,0.08);
  border-color: rgba(14,165,233,0.35);
}

/* Container & header (namespaced) */
#agentic-layer-container.agentic-container {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--zypps-border, #374151);
  border-radius: 10px;
  background: var(--zypps-bg, #0b1220);
  overflow: hidden;
}
#agentic-header.agentic-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--zypps-border, #374151);
  background: var(--zypps-bg-elev, #111827);
}
#agentic-header .agentic-header-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--zypps-text, #e5e7eb);
}
#agentic-header .agentic-header-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--zypps-muted, #9ca3af);
  cursor: pointer;
  font-size: 13px;
}
#agentic-chat-window.agentic-chat-window {
  flex: 1 1 auto;
  overflow: auto;
  padding: 8px 6px 8px 6px;
}
/* ──────────────────────────────────────────────────────────────────────────────
   >>> ADDITIVE STYLES FOR INITIALIZATION FIX & UI TWEAKS <<<
   Purpose: Styles for the mandatory first interaction, progress trail container,
            and the new "Default Location" stage.
   ──────────────────────────────────────────────────────────────────────────────*/

/* Fixes UI overlap by giving the progress trail its own container with spacing */
#agentic-progress-container {
  padding: 6px 10px 8px 10px;
  border-bottom: 1px solid var(--zypps-border, #374151);
  background: linear-gradient(180deg, rgba(14,165,233,0.06), transparent);
}

#agentic-stage-trail {
  display: flex;
  gap: 6px; /* Reduced gap slightly for compact fit */
  align-items: center;
  flex-wrap: wrap; /* Allow wrapping on small screens */
  padding: 0;
  background: none;
  border-bottom: none;
}
#agentic-stage-trail + .agentic-chat-window {
  padding-top: 0.65rem;
}

/* Styles for the initial pickup confirmation prompt */
.agentic-init-prompt {
  padding: 1rem;
  margin: 0.75rem;
  background-color: var(--zypps-surface-2, #111827);
  border: 1px solid var(--zypps-border, #374151);
  border-radius: 10px;
  text-align: center;
  animation: fadeIn 0.4s ease-out;
}

.agentic-init-prompt-text {
  margin: 0 0 1rem 0;
  line-height: 1.5;
  color: var(--zypps-text, #e5e7eb);
}

.agentic-init-prompt-label {
  display: block;
  font-weight: 600;
  padding: 0.75rem;
  margin: 0.5rem 0 1.25rem 0;
  background: var(--zypps-surface, #1F2937);
  border: 1px solid var(--zypps-border, #374151);
  border-radius: 8px;
  color: var(--zypps-accent-2, #22d3ee);
  word-wrap: break-word;
}

.agentic-init-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.agentic-init-actions button {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--zypps-border, #374151);
  background: var(--zypps-bg-elev, #111827);
  color: var(--zypps-text, #e5e7eb);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.agentic-init-actions button:hover:not(:disabled) {
  border-color: var(--zypps-accent, #0ea5e9);
  background-color: var(--zypps-border, #374151);
}

.agentic-init-actions button.primary {
  background: var(--zypps-accent, #0ea5e9);
  border-color: var(--zypps-accent, #0ea5e9);
  color: #FFFFFF;
}

.agentic-init-actions button.primary:hover:not(:disabled) {
  filter: brightness(1.1);
  background: var(--zypps-accent, #0ea5e9);
}

.agentic-init-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================== */
/* >>> ADDITIVE V1.5 START <<<   */
/* ============================== */

/* 1) Header/Progress separation to prevent any overlap with title */
.agentic-header {
  padding-bottom: 0.75rem;            /* extra breathing room below header */
  line-height: 1.25;
}
.agentic-header-title { line-height: 1.3; }

/* 2) When a dedicated progress container is present, maintain spacing */
.agentic-header + #agentic-progress-container { margin-top: 2px; }

/* 3) Visual treatment for the new “Location” pre-stage chip */
#agentic-stage-trail .stage-seg[data-stage="LOCATION"] {
  background: rgba(14,165,233,0.12);
  border-color: rgba(14,165,233,0.35);
  color: var(--zypps-text, #e5e7eb);
  font-weight: 600;
}

/* 4) Active state emphasis for the Location stage */
#agentic-stage-trail .stage-seg[data-stage="LOCATION"].is-active {
  background: rgba(14,165,233,0.20);
  border-color: rgba(14,165,233,0.55);
}

/* 5) Buttons rendered inside the chat bubble by the init prompt */
#agentic-init-prompt-container .agentic-message-bubble button,
#agentic-confirm-pickup,
#agentic-change-pickup {
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--zypps-border, #374151);
  background: var(--zypps-bg-elev, #111827);
  color: var(--zypps-text, #e5e7eb);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.05s ease;
}
#agentic-confirm-pickup {
  background: var(--zypps-accent, #0ea5e9);
  border-color: var(--zypps-accent, #0ea5e9);
  color: #fff;
}
#agentic-confirm-pickup:hover { filter: brightness(1.08); }
#agentic-change-pickup:hover  { border-color: rgba(14,165,233,0.55); background:#1b2434; }
#agentic-init-prompt-container .agentic-message-bubble button:active { transform: translateY(1px); }

/* 6) Safety on tiny modals / very small heights */
@media (max-height: 560px) {
  .agentic-container { height: 400px; }
  #agentic-stage-trail { gap: 4px; }
  .agentic-message .agentic-message-bubble { font-size: 13px; }
}

/* 7) Ensure chat never crowds the progress area on dynamic content injection */
#agentic-progress-container + .agentic-chat-window { padding-top: 8px; }

/* 8) Non-blocking banner for transient errors (if you add .error-bar) */
.agentic-error-bar {
  background: rgba(239,68,68,0.12);
  color: #fecaca;
  border-top: 1px solid rgba(239,68,68,0.35);
  border-bottom: 1px solid rgba(239,68,68,0.35);
  padding: 6px 10px;
  font-size: 12px;
}

/* ============================== */
/* >>> ADDITIVE V1.5 END   <<<   */
/* ============================== */

/* ────────────────────────────────────────────────────────────────────────── */
/* >>> ADDITIVE ENHANCEMENT & REQUIREMENT COMPLETION (Final) <<<              */
/* Date: 2025-10-15                                                           */
/* Purpose: To fully implement and harden the UI requirements from the        */
/* "Implementation Details for the Zypps Agent Layer Initialization Fix"      */
/* document, ensuring all ground rules are met.                               */
/* ────────────────────────────────────────────────────────────────────────── */

/*
  ENHANCEMENT: Hardened Progress Container Spacing
  This rule explicitly ensures the #agentic-progress-container, which was
  added in agentic.html, creates the necessary vertical space to permanently
  fix the header/trail overlap issue as required. The baseline
  file included a version of this, and this updated rule ensures it is robust
  and clearly documented against the requirement.
*/
#agentic-progress-container {
  padding: 0.5rem 0.75rem; /* 8px 12px */
  border-bottom: 1px solid var(--zypps-border, #374151);
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.06), transparent);
  flex-shrink: 0; /* Prevents the container from shrinking */
}

/*
  NEW: Styling for the "Location" Stage
  This new rule directly addresses the requirement to insert a "Location" stage
  before the "Pickup" stage. The implementation document
  specifies a stage key of "DEFAULT_LOCATION" with a label of "Location",
  so this selector is designed to target that specific element when added by the
  updated agentic.js. This styling provides the required visual feedback and
  highlighting for the user during the critical initialization confirmation step.
*/
#agentic-stage-trail .stage-seg[data-stage="DEFAULT_LOCATION"] {
  /* Style to make it stand out as the initial, mandatory step */
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.35);
  color: var(--zypps-accent-2, #22d3ee);
  font-weight: 600;
}

/*
  ENHANCEMENT: Active State for "Location" Stage
  This complements the rule above by providing a more prominent highlight
  when the "Location" stage is the currently active step in the UI, further
  improving user clarity during the boot sequence.
*/
#agentic-stage-trail .stage-seg[data-stage="DEFAULT_LOCATION"].is-active {
  background: rgba(34, 211, 238, 0.2);
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 4px rgba(34, 211, 238, 0.2);
}

/*
  ENHANCEMENT: Hardened Initialization Prompt Button Styles
  While the baseline file provided styles for the initialization prompt, these
  rules have been reviewed and hardened to ensure they are fully compliant with
  the design intent and provide clear, accessible feedback. This directly
  supports the "Use this" or "Change" interaction that is central to the
  initialization fix.
*/
.agentic-init-actions button {
  font-size: 0.9rem; /* Slightly larger font for readability */
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--zypps-border, #374151);
  background-color: var(--zypps-bg-elev, #111827);
  color: var(--zypps-text, #e5e7eb);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.agentic-init-actions button:hover:not(:disabled) {
  border-color: var(--zypps-accent, #0ea5e9);
  background-color: #2a3547; /* Slightly lighter on hover */
  transform: translateY(-1px);
}

.agentic-init-actions button.primary {
  background-color: var(--zypps-accent, #0ea5e9);
  border-color: var(--zypps-accent, #0ea5e9);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.2);
}

.agentic-init-actions button.primary:hover:not(:disabled) {
  background-color: var(--zypps-accent, #0ea5e9); /* Keep color consistent */
  filter: brightness(1.1);
  transform: translateY(-1px);
}
}
