/* === Adventure Buddy Beacon — Clean Theme v3 (Mobile-friendly) === */

/* ---------- Design tokens ---------- */
:root{
  --bg1: #1e293b;
  --bg2: #3a506b;
  --panel: #0b1220;
  --panel-soft: #0b1a2b;
  --text: #e2e8f0;
  --muted: #cbd5e1;
  --border: #334155;
  --brand: #3a506b;

  /* legacy tokens still used in a few places */
  --green: #10b981;   /* primary action */
  --blue:  #2d70d4;  /* route-helper glow, focus, etc. */
  --danger: #f87171;
  --shadow: 0 6px 18px rgba(0,0,0,.35);

  /* ABB button palette */
  --abb-green:       var(--green); /* Start Beacon, Sign up, My Adventures */
  --abb-green-hover: #16a34a;

    --abb-teal:        #2d70d4;      /* secondary positive actions */
  --abb-teal-hover:  #2559a8;


  --abb-gray-btn:        #1e293b;  /* muted / neutral buttons */
  --abb-gray-btn-hover:  #334155;

  --abb-red:        #ef4444;      /* danger */
  --abb-red-hover:  #dc2626;

  --helper-text:    #C8A15A;      /* helper/instructional text */
}


/* Global box sizing so widths include padding/borders */
*,*::before,*::after{ box-sizing:border-box; }

/* ---------- Page base ---------- */
body{
  margin:0;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--text);
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 100%);
  line-height:1.5;
}

/* Centered content ~70% width, capped, with top pad for fixed header */
.wrap{
  width:min(70vw,1000px);
  margin:0 auto;
  padding: 220px 20px 80px;  /* top accounts for fixed header */
}

/* ---------- Header ---------- */
.abb-header{
  position:fixed; top:0; left:0; width:100%;
  display:flex; align-items:center; gap:18px;
  padding:14px 24px;
  background:rgba(11,18,32,.9);
  backdrop-filter: blur(6px);
  box-shadow:0 4px 12px rgba(0,0,0,.4);
  z-index:1000;
}

.abb-inline-brand {
  color: #73c5e6;
  font-weight: 600;
  white-space: nowrap;
}

.abb-logo{
  width:120px; height:120px; border-radius:50%; object-fit:cover;
  box-shadow:0 0 14px rgba(16,185,129,.6);
}
h1{ margin:0 0 6px; font-size:32px; font-weight:800; color:var(--text); }
h2,legend{
  margin:0 0 8px;
  font-size:20px; font-weight:800; color:var(--text);
  text-transform:uppercase; letter-spacing:.03em;
}
.lead{ margin:0; color:var(--muted); }
.lead strong{ color:var(--green); }

/* Header nav container */
.app-nav { margin-left: auto; display:flex; align-items:center; gap:8px; }

/* Responsive logo */
@media (max-width:900px){
  .abb-logo{ width:100px; height:100px; }
}
@media (max-width:600px){
  .abb-logo{ width:72px;  height:72px;  }
}

/* ---------- Active Adventure Banner (sticky + mobile collapse) ---------- */

#active-adventure-banner{
  position: sticky;
  top: 92px;        /* sits below fixed header on desktop */
  z-index: 900;     /* below header (1000), above page content */
}

/* Mobile header is tighter; keep banner tucked under it */
@media (max-width: 600px){
  #active-adventure-banner{
    top: 76px;

    /* Prevent sticky expansion trap on Details */
    max-height: calc(100vh - 90px);
    overflow-y: auto;
  }
}

/* Banner inner shell (injected by renderActiveAdventureBanner) */
#active-adventure-banner .active-adv-banner-inner{
  border: 1px solid var(--border);
  background: rgba(11, 26, 43, 0.92);
  box-shadow: var(--shadow);
  border-radius: 16px;
  margin: 12px 16px;
  padding: 12px 12px;
}

/* Header row: title + Details/Hide button */
#active-adventure-banner .banner-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

#active-adventure-banner .banner-header h3{
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

/* Details area spacing */
#active-adventure-banner .banner-details{
  margin-top: 10px;
}

/* Mobile collapse behavior (your JS toggles .banner-collapsed) */
@media (max-width: 600px){
  #active-adventure-banner.banner-collapsed .banner-details{
    display:none;
  }

  /* Make collapsed banner compact */
  #active-adventure-banner.banner-collapsed .active-adv-banner-inner{
    padding: 10px 12px;
  }

  /* Tighter toggle button in banner */
  #active-adventure-banner .banner-toggle{
    padding: 8px 12px;
    border-radius: 10px;
    margin-top: 0; /* override global button margin-top */
  }
}

/* ---------- Cards (form, preview, saved list) ---------- */
form, .box, #savedList{
  background:var(--panel-soft);
  border:2px solid var(--border);
  border-radius:16px;
  padding:28px 36px 36px;    /* equal L/R gutters */
  box-shadow:var(--shadow);
  width:100%;
}

/* Fieldsets appear as internal sections without extra borders */
fieldset{ border:0; padding:0; margin:0 0 24px; }

/* Add breathing room above standalone field containers within fieldsets */
/* Targets: "Where are you going?" and "Route URL" sections in Adventure form */
fieldset .field {
  margin-top: 20px;
}

/* ---------- Grid helpers (robust, no overflow) ---------- */
.grid{ display:grid; gap:22px; } /* default gap */
.grid-2{
  display:grid; gap:22px;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
}
.grid-3{
  display:grid; gap:22px;
  grid-template-columns: repeat(3, minmax(0,1fr));
}
/* allow children to shrink inside columns */
.grid-2 > *, .grid-3 > *{ min-width:0; }

/* ---------- Form controls ---------- */
/* Add vertical breathing room above labels in grid containers */
/* Improves readability by separating labels from inputs/selects above */
.grid > div > label {
  margin-top: 12px;
}
/* Exception: grids following helper text already have visual separation */
.helper-text + .grid > div > label {
  margin-top: 0;
}

label{ display:block; font-size:14px; color:var(--muted); margin-bottom:6px; }

input, select{
  width:100%; max-width:100%;
  height:48px; padding:12px 14px;
  border-radius:10px; border:2px solid var(--border);
  background:var(--panel); color:var(--text);
}
input[type="date"],input[type="time"]{ height:48px; line-height:48px; }
select{ appearance:none; -webkit-appearance:none; -moz-appearance:none; }
select:focus{ outline:2px solid var(--blue); outline-offset:2px; }

/* ---------- Buttons ---------- */
button,
.btn,
.primary,
.secondary,
.muted,
.danger,
.btn-teal{
  cursor:pointer;
  padding:14px 20px;
  border-radius:12px;
  border:0;
  font-weight:700;
  font-size:15px;
  transition:all .2s ease;
  margin-top:10px;
}

/* PRIMARY – ABB green (Start Beacon, Sign up, My Adventures) */
.primary{
  background:var(--abb-green);
  color:#06251e;
  text-decoration: none;
}
.primary:hover{
  background:var(--abb-green-hover);
}
a.primary,
a.primary:visited,
a.primary:hover,
a.primary:active,
a.primary:focus{
  text-decoration: none;
}

/* BEACON ACTIVE – blue-gray outline (status indicator, not CTA) */
.btn-beacon-active{
  background:transparent;
  border:2px solid #64748b;
  color:#94a3b8;
}
.btn-beacon-active:hover{
  background:rgba(100,116,139,0.1);
  border-color:#94a3b8;
}
.btn-beacon-active:disabled{
  opacity:0.8;
  cursor:default;
}

/* SECONDARY – ABB teal (Save actions, non-primary positive) */
.btn-teal{
  background:var(--abb-teal);
  color:#ecfeff;
}
.btn-teal:hover{
  background:var(--abb-teal-hover);
}

/* LIGHT SECONDARY – e.g. "I'm back safe" */
.secondary{
  background:#f9fafb;
  color:#0f172a;
  border:1px solid #cbd5f5;
}
.secondary:hover{
  background:#e5e7eb;
}

/* MUTED – neutral actions and nav buttons */
.muted,
.app-nav .btn{
  background:var(--abb-gray-btn);
  color:var(--muted);
  border:1px solid var(--border);
}
.muted:hover,
.app-nav .btn:hover{
  background:var(--abb-gray-btn-hover);
}

/* DANGER – destructive actions (Delete) */
.danger{
  background:var(--abb-red);
  color:#fff;
}
.danger:hover{
  background:var(--abb-red-hover);
}

/* Generic hover shadow */
button:hover,
.btn:hover{
  transform:translateY(-1px);
  box-shadow:0 0 12px rgba(15,23,42,0.45);
}

/* Prevent hover lift/shadow on disabled buttons (status states) */
button:disabled:hover{
  transform:none;
  box-shadow:none;
}


/* ---------- Status text ---------- */
.ok{ color:var(--green); font-weight:600; }
.note{ font-size:13px; color:#94a3b8; margin-top:8px; }

/* ---------- Helper/instructional text (explicit opt-in only) ---------- */
.helper-text {
  color: var(--helper-text);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
}

/* Expected return helper text spacing */
.expected-return-helper {
  margin-top: 8px;
  margin-bottom: 10px;
}

/* ---------- Contact selection rows ---------- */
.abb-contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.abb-contact-row:hover,
.abb-contact-row:focus-within {
  background-color: var(--panel-soft);
}

.abb-contact-checkbox {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.abb-contact-info {
  flex: 1;
  min-width: 0;
}

.abb-contact-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.abb-contact-email {
  font-size: 13px;
  color: #9fb2c5;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Saved adventure list items ---------- */
.saved-item{
  background:#0f172a; border:1px solid var(--border); border-radius:10px;
  padding:12px 16px; display:flex; justify-content:space-between; align-items:center;
  margin-bottom:8px;
  gap:12px;
}

/* ---------- Route URL input row (input + clear button) ---------- */
.route-url-row{
  position:relative;
  display:flex;
  align-items:center;
}
.route-url-row input{
  flex:1;
  padding-right:48px; /* room for 44px clear button */
}
.clear-route-btn{
  position:absolute;
  right:2px;
  display:flex;
  align-items:center;
  justify-content:center;
  width:44px; height:44px;
  padding:0; margin:0;
  border:none;
  border-radius:10px;
  background:transparent;
  color:var(--muted);
  font-size:18px;
  cursor:pointer;
  transition:color .15s;
}
.clear-route-btn:hover{
  color:var(--text);
  background:rgba(148,163,184,0.12);
  transform:none;
  box-shadow:none;
}
.provider-badge{
  display:inline-block;
  margin-top:6px;
  padding:4px 10px;
  font-size:13px;
  font-weight:600;
  color:var(--muted);
  background:transparent;
  border:2px solid var(--border);
  border-radius:10px;
}

/* ---------- Helper links row (equal boxes that fit container) ---------- */
.route-links{
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr)); /* 4 equal boxes in one row */
  gap:12px; margin-top:8px; margin-bottom:20px;
}

/* ---------- POI helper buttons — visible by default (desktop-first) ---------- */
.route-links a{
  display:flex;
  align-items:center;
  justify-content:center;

  height:44px;
  padding:0 12px;

  text-decoration:none;
  white-space:nowrap;

  background: rgba(30, 41, 59, 0.35);   /* subtle fill to prevent blending */
  color: var(--text);
  font-weight:700;

  border:2px solid var(--blue);        /* high-contrast ABB outline */
  border-radius:10px;

  transition: all .20s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

/* Hover / focus */
.route-links a:hover{
  background: var(--brand);
  border-color: var(--blue);
  color:#fff;
  box-shadow: 0 0 12px rgba(59,130,246,0.45);
}

.route-links a:active{
  transform: scale(0.98);
  box-shadow: 0 0 16px rgba(59,130,246,0.55);
}

/* wrap to 2 then 1 column on narrow screens (keeps inside card) */
@media (max-width:768px){
  .route-links{ grid-template-columns: repeat(2, minmax(0,1fr)); }

  /* Mobile: filled button style for better touch targets */
  .route-links a{
    background: var(--brand);
    border-color: var(--blue);
    color:#fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  }
}
@media (max-width:560px){
  .route-links{ grid-template-columns: 1fr; }
}

/* ---------- Accessibility helpers ---------- */
.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;
}

/* ---------- Action buttons row (4 evenly spaced buttons) ---------- */
.actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)); /* 4 equal buttons */
  gap: 16px;
  margin-top: 18px;
  width: 100%;
}

.actions button {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  transition: all 0.2s ease;
  /* Text containment for long labels like "Save this adventure (template)" */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  padding: 10px 12px;
}

/* --- Solo / Companions row tweaks --- */
#solo {
  width: 20px;
  height: 20px;
  accent-color: var(--green); /* same as Start Beacon color */
}
#companions {
  height: 48px;
}

/* Solo checkbox color + disabled companions look */
#companions:disabled { opacity: .6; cursor: not-allowed; }

/* --- Error message box styling --- */
.error-box {
  background: rgba(248, 113, 113, 0.15);   /* soft red background */
  border: 2px solid #f87171;               /* same red as .danger buttons */
  color: #fca5a5;                          /* lighter red text */
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 12px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.3);
}

/* --- App header nav link --- */
.app-nav .home-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: #e2e8f0;
  text-decoration: none;
  font-weight: 700;
}
.app-nav .home-link:hover {
  border-color: var(--blue);
  background: #0b1a2b;
  box-shadow: 0 0 10px rgba(59,130,246,0.25);
}
/* --- Navigation buttons (Profile & Logout) --- */
.app-nav .nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  height: 44px;              /* ensure consistent height */
  border: 1px solid var(--border);
  background: var(--abb-gray-btn);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.app-nav .nav-btn:hover {
  background: var(--abb-gray-btn-hover);
}
/* Remove top margin for header nav buttons */
.nav-btn {
  margin-top: 0 !important;
}

/* Slightly brighter text for Logout only */
#logout-btn.nav-btn {
  color: #f1f5f9; /* brighter text for visibility */
}

/* =========================================================
   RESPONSIVE LAYOUT TWEAKS (APP VIEW)
   ========================================================= */

/* Medium screens: loosen width & padding, header wraps nicely, grids shrink */
@media (max-width: 980px) {
  .wrap{
    width:min(92vw, 800px);
    padding: 190px 16px 60px;  /* slightly less top padding */
  }

  .abb-header{
    flex-wrap:wrap;
    align-items:flex-start;
    gap:10px;
  }

  .app-nav{
    margin-left:0;
    margin-top:8px;
    flex-wrap:wrap;
    justify-content:flex-start;
  }

  .grid-3{
    grid-template-columns: repeat(2, minmax(0,1fr));
  }

  .actions{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Small screens: full-width layout, single-column grids, tighter padding */
@media (max-width: 600px) {
  .wrap{
    width:100%;
    padding: 150px 12px 40px; /* smaller header spacing on mobile */
  }

  .abb-header{
    padding:10px 12px;
    gap:10px;
    /* Mobile perf: disable GPU blur, use solid background instead */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(11, 18, 32, 0.96);
  }

  .abb-header > div:nth-child(2){
    /* title + lead block */
    flex:1 1 100%;
  }

  form, .box, #savedList{
    padding:20px 16px 24px;
  }

  .grid-2,
  .grid-3{
    grid-template-columns: 1fr;
  }

  .actions{
    grid-template-columns: 1fr;
  }

  .saved-item{
    flex-direction:column;
    align-items:flex-start;
  }
} 

/* Escalation explainer (Adventure page) */
.escalation-explainer {
  margin: 12px 0 16px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,0.25);
  background: rgba(30, 41, 59, 0.35);
}

.escalation-explainer p {
  font-size: 14px;
  line-height: 1.45;
}

.escalation-explainer-text {
  margin: 0;
}

.cta-price{
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.3;
  text-align: center;
}

/* Hide header tagline on small screens */
@media (max-width: 640px){
  .abb-header-text > .lead{
    display: none !important;
  }
}
