/* Alex Rivers — re:Invent Concierge app shell */
:root {
  --bg: #0f1226;
  --panel: #171b38;
  --panel-border: #2a2f52;
  --ink: #f2f3fa;
  --muted: #c6c9e0;
  --faint: #8b90b3;
  --accent: #d8f24b;
  --fa-primary-color: #00f0ff;
  --fa-secondary-color: #c724ff;
  --fa-secondary-opacity: 0.45;
}
* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
a { color: #9fd8ff; }

.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--panel-border);
  position: sticky; top: 0; background: rgba(15, 18, 38, 0.92); backdrop-filter: blur(8px); z-index: 500;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }
.brand-name { font-weight: 700; font-size: 1.05rem; }
.brand-sub { color: var(--faint); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.loc-chip { color: var(--accent); font-size: 0.85rem; }

.view-nav {
  display: flex; gap: 6px; padding: 10px 16px 0; flex-wrap: wrap;
}
.view-btn {
  background: var(--panel); color: var(--muted); border: 1px solid var(--panel-border);
  border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: 0.92rem;
  display: inline-flex; align-items: center; gap: 8px;
}
.view-btn.is-active { color: #0c0c0c; background: var(--accent); border-color: var(--accent); font-weight: 600; }

.app-main { padding: 14px 16px 30px; max-width: 1500px; margin: 0 auto; }
.view { display: none; }
.view.is-active { display: block; }

.info-card { display: block; margin-top: 16px; }
.info-card h3 { margin: 0 0 8px; font-size: 1rem; }
.info-card p { color: var(--muted); line-height: 1.5; }
.muted { color: var(--faint); }
#omniagent-error { display: none; margin-top: 16px; background: #3a1730; border: 1px solid #7a2d5e; color: #ffd7ef; border-radius: 10px; padding: 12px 14px; }
#requests-list { color: var(--muted); line-height: 1.5; }

.map-toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 10px; }
.map-toolbar label { display: grid; gap: 4px; font-size: 0.8rem; color: var(--faint); }
.day-select {
  background: var(--panel); color: var(--ink); border: 1px solid var(--panel-border);
  border-radius: 8px; padding: 8px 10px; font-size: 0.95rem;
}
#map { height: 56vh; min-height: 340px; border-radius: 12px; border: 1px solid var(--panel-border); z-index: 1; }
.route-card { display: block; margin-top: 14px; }
.route-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.route-head h3 { margin: 0; font-size: 1rem; }
#route-steps { color: var(--muted); line-height: 1.55; padding-left: 20px; }
.route-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.ext-btn {
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
  border: 1px solid var(--panel-border); border-radius: 999px; padding: 8px 13px;
  color: var(--ink); background: var(--panel); font-size: 0.9rem;
}
.ext-btn:hover { border-color: var(--accent); }

.info-card input[type="text"] {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06); color: inherit; font: inherit;
}
.omniagent-panel { overflow: hidden; }
.omniagent-mount { background: transparent; }
.mount-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0; pointer-events: none;
}
.omniagent-sdk-root { z-index: 1; }
.catalog-search {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 6px;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; padding: 10px 12px;
}
.catalog-search input {
  flex: 1; background: transparent; border: 0; outline: none; color: var(--ink); font-size: 0.98rem;
}
.catalog-search input::placeholder { color: var(--faint); }
.day-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.day-tab {
  background: var(--panel); color: var(--muted); border: 1px solid var(--panel-border);
  border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 0.9rem;
}
.day-tab.is-active { background: var(--accent); color: #0c0c0c; border-color: var(--accent); font-weight: 600; }
.type-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.type-chip {
  background: transparent; color: var(--faint); border: 1px solid var(--panel-border);
  border-radius: 999px; padding: 5px 11px; cursor: pointer; font-size: 0.82rem;
}
.type-chip.is-active { color: var(--ink); border-color: var(--accent); }

.event-list { display: grid; gap: 10px; }
.event-item { display: block; }
.event-item .ev-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.event-item h4 { margin: 0; font-size: 0.98rem; }
.event-item .ev-meta { color: var(--faint); font-size: 0.85rem; margin: 4px 0; }
.event-item .ev-desc { color: var(--muted); font-size: 0.9rem; line-height: 1.45; margin: 4px 0 8px; }
.event-item .ev-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ev-dist { color: var(--accent); font-size: 0.85rem; white-space: nowrap; }

/* ---------- Official floor plans (Map view) ----------------------------- */
.floorplans-card { display: block; margin-top: 14px; }
.floorplans-card h3 { margin: 0 0 6px; font-size: 1rem; }
.plan-links { margin: 8px 0 0; padding-left: 20px; }
.plan-links li { margin: 7px 0; }

/* ---------- Venue picker (Near view) ------------------------------------ */
.venue-pick-card { display: block; margin-bottom: 14px; }
.venue-pick-card h3 { margin: 0 0 6px; font-size: 1rem; }
.venue-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------- Upgrade guards: no unstyled flash, no layout shift --------- */
wa-card:not(:defined), wa-button:not(:defined),
wa-switch:not(:defined), wa-details:not(:defined) { visibility: hidden; }
.switch-row { min-height: 30px; display: flex; align-items: center; }

/* ---------- Highlight flash (Alex points at content) -------------------- */
.is-highlighted { animation: highlight-pulse 1.05s ease-in-out 3; }
@keyframes highlight-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0); outline: 2px solid rgba(0, 240, 255, 0); outline-offset: 2px; }
  50% { box-shadow: 0 0 24px 4px rgba(0, 240, 255, 0.45); outline: 2px solid #00f0ff; outline-offset: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .is-highlighted { animation: none; outline: 2px solid #00f0ff; outline-offset: 2px; }
}
.feed-acc { display: block; margin-top: 16px; }
.feed-acc [slot="summary"] {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 1rem;
}
.feed-acc .feed { margin-top: 10px; }
.feed-acc .link-outs { margin: 10px 0 0; }
.feed { display: grid; gap: 12px; }
.feed-post { border-top: 1px solid var(--panel-border); padding-top: 10px; }
.feed-post:first-child { border-top: 0; padding-top: 0; }
.feed-post .fp-head { font-size: 0.85rem; color: var(--faint); }
.feed-post .fp-head b { color: var(--ink); }
.feed-post p { margin: 4px 0 0; color: var(--muted); line-height: 1.45; }
.feed-news a { color: var(--ink); text-decoration: none; font-weight: 600; }
.feed-news a:hover { color: var(--accent); }
.link-outs { line-height: 2; }

.app-footer { color: var(--faint); font-size: 0.85rem; line-height: 1.5; padding: 0 16px 90px; max-width: 1500px; margin: 0 auto; }

/* Leaflet dark popups */
.leaflet-popup-content-wrapper { background: #171b38; color: var(--ink); }
.leaflet-popup-tip { background: #171b38; }
.leaflet-popup-content { font-size: 0.9rem; line-height: 1.4; }
.leaflet-popup-content b { display: block; margin-bottom: 2px; }

/* Desktop app layout: Alex stays on the left, views fill the right pane */
@media (min-width: 1024px) {
  .app-main { display: grid; grid-template-columns: 430px 1fr; gap: 18px; align-items: start; }
  .view-talk { display: block !important; grid-column: 1; position: sticky; top: 86px; }
  .view:not(.view-talk) { grid-column: 2; }
  .view-btn[data-view="talk"] { display: none; }
  #map { height: calc(100vh - 240px); }
  .app-footer { padding-bottom: 30px; }
}
@media (max-width: 1023px) {
  .brand-sub { display: none; }
}

/* ---------- Alex panel: minimize / restore ----------------------------- */
.omniagent-panel { transition: width 220ms ease; z-index: 700; }
.omniagent-header { justify-content: flex-start; }
.omniagent-status { margin-left: auto; }
.omniagent-min-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.08); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.omniagent-min-btn:hover { background: rgba(255, 255, 255, 0.18); }
.omniagent-min-btn .chev {
  display: block; width: 9px; height: 9px;
  border-right: 2.4px solid currentColor; border-bottom: 2.4px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 200ms ease;
}
.omniagent-panel.is-minimized .omniagent-min-btn .chev {
  transform: rotate(225deg) translate(-1px, -1px);
}
.omniagent-panel.is-minimized { width: 148px; height: auto; }
.omniagent-panel.is-minimized .omniagent-header { height: 38px; padding: 0 6px 0 12px; }
.omniagent-panel.is-minimized .omniagent-title {
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.omniagent-panel.is-minimized .omniagent-status { display: none; }
.omniagent-panel.is-minimized .omniagent-restart-btn { display: none; }
.omniagent-panel.is-minimized .omniagent-min-btn { margin-left: auto; }
.omniagent-panel.is-minimized .omniagent-mount { flex: none; height: 148px; }
.omniagent-panel.is-minimized .omniagent-footer { display: none; }

/* ---------- Bottom-anchored tab bar + floating Alex on mobile -------- */
@media (max-width: 1023px) {
  .view-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 600;
    flex-wrap: nowrap; justify-content: space-around; gap: 2px;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: rgba(13, 16, 34, 0.95);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--panel-border);
  }
  .view-btn {
    flex: 1 1 0; flex-direction: column; justify-content: center; gap: 3px;
    background: transparent; border-color: transparent; border-radius: 12px;
    padding: 6px 2px; font-size: 0.7rem; white-space: nowrap;
  }
  .view-btn svg { width: 1.25rem; height: 1.25rem; }
  .view-btn.is-active {
    background: rgba(216, 242, 75, 0.12); color: var(--accent); border-color: transparent;
  }
  .app-footer { padding-bottom: 112px; }
  /* The panel is fixed, so keep it (and only it) on screen in other views */
  .view-talk:not(.is-active) { display: block; }
  .view-talk:not(.is-active) > :not(.omniagent-panel) { display: none !important; }
  /* Panel clears the tab bar, expanded and minimized */
  .omniagent-panel { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* Weather card (Talk view) */
.weather-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.weather-day { border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px; padding: 8px 6px; text-align: center; }
.weather-day .wd-dow { font-weight: 600; font-size: 0.8rem; }
.weather-day .wd-temps { font-size: 0.95rem; margin: 2px 0; }
.weather-day .wd-phrase { font-size: 0.72rem; opacity: 0.75; line-height: 1.25; }
.weather-day .wd-pop { font-size: 0.72rem; color: #7dd3fc; }
#weather-now { font-size: 1.02rem; }
@media (max-width: 480px) { .weather-days { gap: 5px; } .weather-day .wd-phrase { display: none; } }

/* Chat view */
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.chat-head h3 { margin: 0; }
.chat-head-actions { display: flex; gap: 8px; }
.chat-thread { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; padding: 12px 2px; }
.chat-msg { max-width: 85%; padding: 8px 12px; border-radius: 14px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.chat-msg .chat-who { display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.65; margin-bottom: 2px; }
.chat-msg .chat-when { display: block; font-size: 0.68rem; opacity: 0.6; margin-top: 4px; }
.chat-msg.user { align-self: flex-end; background: rgba(0, 240, 255, 0.13); border: 1px solid rgba(0, 240, 255, 0.35); border-bottom-right-radius: 4px; }
.chat-msg.alex { align-self: flex-start; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); border-bottom-left-radius: 4px; }
.chat-composer { display: flex; gap: 8px; margin-top: 6px; }
.chat-composer input { flex: 1; }
.chat-empty { text-align: center; padding: 18px 8px; }

/* ---- boot / loading screen ---- */
#boot-screen { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(120% 90% at 50% 0%, #1b1040 0%, #0f1226 55%, #090b1a 100%); color: #f2f3ff; text-align: center; padding: 24px; transition: opacity .5s ease, visibility .5s; }
#boot-screen.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-icon { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 0 0 2px rgba(0, 240, 255, .55), 0 12px 40px rgba(199, 36, 255, .35); }
.boot-name { font-size: 28px; font-weight: 700; letter-spacing: .2px; margin-top: 10px; }
.boot-sub { color: #b9bce0; font-size: 14px; letter-spacing: .12em; text-transform: uppercase; }
.boot-bar { width: 168px; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .14); overflow: hidden; margin-top: 18px; }
.boot-bar span { display: block; height: 100%; width: 40%; border-radius: 999px; background: linear-gradient(90deg, #00f0ff, #c724ff); animation: boot-slide 1.15s ease-in-out infinite; }
@keyframes boot-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(280%); } }
.boot-note { color: #8f93b8; font-size: 13px; margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .boot-bar span { animation: none; width: 100%; } }
