/* ============================================================
   BENTO & POP — Design Tokens + Functional Bridge Classes
   ============================================================ */

/* ---------- Fonts & Base ---------- */
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 400;
  background-color: #FBF8F3;
  color: #1d4e89;
}
.font-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
}

/* ---------- Color Palette ---------- */
:root {
  --navy-dark: #0e1830;
  --navy-text: #1a2540;
  --lime-accent: #d7f542;
  --orange-accent: #f4791d;
  --purple-accent: #6a63e8;
  --yellow-badge: #f4b400;
  --red-destructive: #d64545;
  --gray-muted: #8a93a6;
  --gray-light: #c7cdda;
  --gray-lighter: #aab3c9;
  --page-bg: #f4f5f9;
  --card-bg: #ffffff;
  --border-light: #c9c9f0;
}

/* ---------- Pop Card ---------- */
.pop-card {
  border: 3px solid #1d4e89;
  box-shadow: 4px 4px 0px #1d4e89;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pop-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px #1d4e89;
}

/* ---------- Pop Button ---------- */
.pop-btn {
  border: 2px solid #1d4e89;
  box-shadow: 3px 3px 0px #1d4e89;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 700;
}
.pop-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0px #1d4e89;
}
.pop-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px #1d4e89;
}

/* ---------- Main Content Cards (soft shadow, no border) ---------- */
.card-soft {
  border-radius: 22px;
  border: none;
  box-shadow: 0 2px 18px rgba(15, 23, 42, 0.06);
  background-color: #ffffff;
}

/* ============================================================
   FUNCTIONAL BRIDGE CLASSES
   These are toggled by JavaScript — they must exist in CSS
   ============================================================ */

/* ---------- Stage visibility (Finder wizard) ---------- */
.stage { display: none; }
.stage.active { display: block; }

/* ---------- Nav dropdown panels (e.g. "Add Custom Item") ---------- */
.nav-dropdown-panel { display: none; }
.nav-dropdown-panel.open { display: block; }

/* ---------- Review popover (anchored to the review status pill on opportunity cards) ----------
   Absolutely positioned so revealing it overlaps the card content below instead of pushing
   it down/growing the card. */
.review-popover-panel {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 6px;
  width: 240px;
  z-index: 30;
  box-shadow: 3px 3px 0px #0F172A;
}
.review-popover-panel.open { display: block; }

/* ---------- Error / status boxes ---------- */
.form-error { display: none; }
.form-error.show { display: block; }

.intake-error { display: none; }
.intake-error.show { display: block; }

.progress-note { display: none; }
.progress-note.show { display: block; }

.change-banner { display: none; }
.change-banner.show { display: block; }

.error-banner { display: none; }
.error-banner.show { display: block; }

/* ---------- Button loading state ---------- */
.pop-btn.loading { opacity: 0.65; cursor: wait; pointer-events: none; }
.pop-btn.loading .spin { display: inline-block !important; }

/* ---------- Step nav states ---------- */
.step { cursor: default; opacity: 0.5; }
.step.active { opacity: 1; font-weight: 800; }
.step.active .num { background: #0F172A; color: #fff; }
.step.done { opacity: 0.75; }
.step.done .num { background: #6EE7B7; color: #0F172A; }
.step.clickable { cursor: pointer; }
.step.clickable:hover { opacity: 1; }

/* ---------- Result card selection state ---------- */
.result-card { transition: box-shadow 0.15s; }

/* ---------- Quest Log: Calendar/List view tabs ---------- */
.view-tabs { display: inline-flex; background: #eef0fb; border-radius: 999px; padding: 3px; gap: 2px; }
.view-tab { border: none; background: none; cursor: pointer; font-weight: 800; font-size: 13px; padding: 8px 14px; border-radius: 999px; color: #5b6785; display: flex; align-items: center; gap: 6px; }
.view-tab.active { background: #1d4e89; color: #fff; }

/* ---------- Quest Log: circular icon buttons (save/delete/refresh) ---------- */
.icon-btn { width: 30px; height: 30px; border-radius: 999px; background: #fff; border: 2px solid #1d4e89; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ---------- Quest Log: deadline list, grouped by year ---------- */
.date-year-tag { font-weight: 800; font-size: 10px; color: #0f1c33; background: #eee9dd; border-radius: 6px; padding: 3px 8px; display: inline-block; margin: 10px 0 6px; font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.03em; }
.date-year-tag:first-child { margin-top: 0; }
.date-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid #eee; font-size: 14px; }
.date-row:last-child { border-bottom: none; }

/* ---------- Calendar strip ---------- */
.month-card {
  width: 200px;
  background: #F8FAFC;
  border: 2px solid #CBD5E1;
  border-radius: 16px;
  padding: 12px;
  flex-shrink: 0;
}
.month-card.current-month {
  border: 3px solid #6366F1;
  background: #EEF2FF;
  box-shadow: 3px 3px 0px #6366F1;
}
.month-card.next-month {
  border: 3px solid #A5B4FC;
  background: #F5F5FF;
  box-shadow: 3px 3px 0px #A5B4FC;
}
.month-head { font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #64748B; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.month-head .now-badge {
  background: #6366F1;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 999px;
}
.month-head .now-badge.next-badge { background: #A5B4FC; color: #1E1B4B; }
.month-entries { display: flex; flex-direction: column; gap: 6px; }
.month-entry { border-radius: 8px; padding: 6px 8px; border-left: 3px solid; display: flex; align-items: flex-start; gap: 8px; }
.month-entry .day { font-weight: 800; font-size: 18px; line-height: 1; flex-shrink: 0; }
.month-entry .entry-text { font-size: 11px; line-height: 1.4; }
.month-entry .entry-text strong { display: block; }
.month-entry .entry-type { font-size: 9px; text-transform: uppercase; opacity: 0.7; }
/* Flags a milestone whose date has already passed relative to today — typically a stale/
   un-refreshed AI-extracted date rather than a genuine past event, so it stays visible
   (never silently hidden) but is clearly de-emphasized and distinguishable from real
   upcoming dates. See getDisplayMilestones() in script.js. */
.month-entry-past { opacity: 0.5; filter: grayscale(40%); }
.month-entry-past .entry-type { font-style: italic; }
.empty-state { color: #94A3B8; font-style: italic; font-size: 13px; }

/* ---------- Calendar legend ---------- */
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 4px; }

/* ---------- Profile drawer (sidebar) ---------- */
/* The profilePanel starts with translate-x-full (from Tailwind) = hidden.
   toggleProfile() toggles that class. No extra CSS needed. */

/* ---------- Selection bar — visibility controlled via style.display by JS ---------- */

/* ---------- Input / textarea focus ---------- */
textarea:focus, input:focus, select:focus {
  outline: 2px solid #00b2ca;
  outline-offset: 1px;
}

/* ============================================================
   UTILITY
   ============================================================ */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Confirm-armed state for destructive buttons (e.g. Clear Profile) */
.confirm-armed {
  background: #fbd1a2 !important;
  color: #8A4A0E !important;
}

/* ---------- Progress bars (Home) ---------- */
.progress-track {
  display: flex;
  width: 100%;
  height: 22px;
  border: 2px solid #1d4e89;
  border-radius: 999px;
  overflow: hidden;
  background: #FBF8F3;
}
.progress-seg { height: 100%; transition: width 0.3s ease; }
/* Sunset palette — teal = Happening Now / Completed, mint = Future Event / In Progress,
   peach = Past Event / Not Started. */
/* Opportunity event-timing state (Happening Now / Future Event / Past Event). */
.progress-seg.seg-opp-in_progress { background: #00b2ca; }
.progress-seg.seg-opp-not_started { background: #7dcfb6; }
.progress-seg.seg-opp-completed { background: #fbd1a2; }
/* Task (action-item) state (Not Started / In Progress / Completed). */
.progress-seg.seg-task-not_started { background: #f79256; }
.progress-seg.seg-task-in_progress { background: #00b2ca; }
.progress-seg.seg-task-completed { background: #7dcfb6; }

.progress-legend-item { display: flex; align-items: center; gap: 6px; color: #1d4e89; }
.progress-legend-dot { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.progress-legend-dot.seg-opp-in_progress { background: #00b2ca; }
.progress-legend-dot.seg-opp-not_started { background: #7dcfb6; }
.progress-legend-dot.seg-opp-completed { background: #fbd1a2; }
.progress-legend-dot.seg-task-not_started { background: #f79256; }
.progress-legend-dot.seg-task-in_progress { background: #00b2ca; }
.progress-legend-dot.seg-task-completed { background: #7dcfb6; }

/* ---------- Status pills (system-controlled, Tracker + Home to-do) ---------- */
.status-pill {
  padding: 3px 10px;
  border-radius: 999px;
  border: 2px solid #1d4e89;
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.status-pill.cursor-pointer {
  cursor: pointer;
}
.status-pill.cursor-pointer:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  border-color: #1d4e89;
  font-weight: 900;
}
.status-pill.cursor-pointer:active {
  transform: translateY(0px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* Opportunity event-timing state: teal = Happening Now, mint = Future Event, peach = Past Event. */
.status-pill.status-opp-in_progress { background: #D8F0E9; color: #1A6E58; }
.status-pill.status-opp-not_started { background: #CDEAF2; color: #00697A; }
.status-pill.status-opp-completed { background: #FCE9D0; color: #8A4A0E; }
/* Task state: peach = Not Started, teal = In Progress, mint = Completed. */
.status-pill.status-task-not_started { background: #fbd1a2; color: #8A4A0E; }
.status-pill.status-task-in_progress { background: #CDEAF2; color: #00697A; }
.status-pill.status-task-completed { background: #D8F0E9; color: #1A6E58; }

/* ---------- Hero suggest card (Finder stage 0) ---------- */
.hero-suggest-card { position: relative; overflow: hidden; }

/* ---------- Modal overlays (Home to-do detail, Finder result detail) ---------- */
/* Single scroll container: the overlay itself scrolls (not the panel). Nesting two
   independent overflow:auto containers here was unreliable — depending on how the
   viewport height was computed (vh/dvh, embedded iframe, etc.) the panel's own
   max-height/overflow could end up never triggering, making long content look
   unscrollable even though it was cut off. Letting the panel grow to its natural
   height and scrolling the fixed, full-viewport overlay around it always works. */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 200;
}
.modal-overlay.hidden { display: none; }
.modal-panel {
  background: #fff;
  border: none;
  box-shadow: 0 2px 18px rgba(15, 23, 42, 0.06);
  border-radius: 22px;
  max-width: 640px;
  width: 100%;
  flex-shrink: 0;
}
/* Hover-highlight is the default treatment for every card container on Home base
   and My Vibe (page-profile) — keeps the two pages feeling consistently interactive. */
#page-home .card-soft,
#page-profile .card-soft {
  transition: background-color 0.15s ease;
}
#page-home .card-soft:hover,
#page-profile .card-soft:hover {
  background-color: #FBF3E9;
}
#homeTodoCard { cursor: pointer; }

/* ---------- Tracker: Active / Saved tabs ---------- */
.tracker-tab-btn.active { background: #E0E7FF !important; }

/* ---------- Dismissible banners ---------- */
.banner-dismiss {
  float: right;
  font-weight: 800;
  cursor: pointer;
  margin-left: 8px;
  line-height: 1;
}

/* ---------- Finder result cards (clickable to expand) ---------- */
.result-card-clickable { cursor: pointer; }

/* ---------- Dark header nav tabs ---------- */
.nav-tab-btn {
  color: #B7D3E8;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-tab-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav-tab-btn.active,
.nav-tab-btn.active:hover {
  background: #f79256;
  color: #fff;
}

/* ---------- Dashboard profile teaser: urgency pulse ---------- */
@keyframes urgentPulse {
  0%, 100% { box-shadow: 4px 4px 0px #1d4e89; }
  50% { box-shadow: 4px 4px 0px #1d4e89, 0 0 0 6px rgba(247, 146, 86, 0.3); }
}
.urgent-pulse { animation: urgentPulse 1.8s ease-in-out infinite; }

/* ---------- Profile builder chat ---------- */
.chat-bubble-bot {
  background: #fff;
  border: 2px solid #0F172A;
  border-radius: 14px 14px 14px 2px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  max-width: 85%;
  align-self: flex-start;
}
.chat-bubble-user {
  background: #E0E7FF;
  border: 2px solid #0F172A;
  border-radius: 14px 14px 2px 14px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  max-width: 85%;
  align-self: flex-end;
  margin-left: auto;
}
#profileChatMessages { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Profile builder chat: starter-question picker buttons ---------- */
/* Distinct from .chat-bubble-bot (which is capped at 85% width for message bubbles) —
   these need to span the full messages panel so all 3 options are easy to scan/tap. */
.chat-starter-btn {
  background: #fff;
  border: 2px solid #0F172A;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  align-self: stretch;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s;
}
.chat-starter-btn:hover { background: #EEF2FF; }

/* ---------- Profile builder chat: voice input (mic) ---------- */
@keyframes micPulse {
  0%, 100% { box-shadow: 3px 3px 0px #0F172A; }
  50% { box-shadow: 3px 3px 0px #0F172A, 0 0 0 6px rgba(225, 29, 72, 0.25); }
}
.mic-listening {
  background: #E11D48 !important;
  color: #fff !important;
  animation: micPulse 1.2s ease-in-out infinite;
}

/* ---------- Result card hover expansion ---------- */
.no-clamp {
  overflow: visible;
  -webkit-line-clamp: unset;
  display: block;
}

/* ---------- Profile page specific styles ---------- */
#profileCtaBanner a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 20px;
  border-radius: 16px;
  padding: 20px 26px;
  box-shadow: 0 6px 20px rgba(16, 28, 54, 0.18);
  transition: transform 0.2s ease;
}

#profileCtaBanner a:hover {
  transform: translateY(-2px);
}

#profileContent p {
  color: #1a2540;
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 20px;
}

#researchList {
  display: flex;
  gap: 12px;
  flex-direction: column;
}

#researchList > div {
  display: flex;
  gap: 12px;
}

#researchList .research-number {
  color: #6a63e8;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state { color: #9AA9B8; }

/* ============================================================
   MY VIBE (Profile page)
   ============================================================ */

/* ---------- Read-only profile fields ---------- */
.vibe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.vibe-field {
  background: #fff;
  border: 2px solid #eef0fb;
  border-radius: 16px;
  padding: 14px 16px;
}
.vibe-grid + #profileContent > .vibe-field { margin-top: 12px; }
#profileContent > .vibe-field + .vibe-field { margin-top: 12px; }
.vibe-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #8a93a6;
  margin: 0 0 6px;
}
.vibe-value {
  font-size: 14px;
  font-weight: 700;
  color: #1a2540;
  margin: 0;
  line-height: 1.6;
}
.vibe-value.empty { color: #b8bfcd; font-weight: 600; font-style: italic; }
.vibe-body { font-weight: 600; }
.vibe-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vibe-list li { font-size: 14px; font-weight: 600; color: #1a2540; line-height: 1.5; }

/* ---------- Newly-added profile text, flashed for 5s after a chat is folded in ----------
   The alpha is driven through a registered custom property because gradients are not
   interpolable: animating `background-image` between two linear-gradients jumps rather
   than fades, and animating the mark's own opacity would fade the text with it. Where
   @property is unsupported the alpha steps instead of easing — the mark is removed from
   the DOM at 5s either way (see flagNewProfileText), so it degrades to a plain cut.
   box-decoration-break keeps the gradient drawn per line-box, so a highlighted sentence
   that wraps gets the treatment on each line instead of one box around the whole run. */
@property --profile-new-alpha {
  syntax: '<number>';
  initial-value: 1;
  inherits: false;
}
.profile-new {
  background-image: linear-gradient(100deg,
    rgba(255, 166, 46, var(--profile-new-alpha, 1)) 0%,
    rgba(255, 209, 125, var(--profile-new-alpha, 1)) 48%,
    rgba(255, 240, 201, var(--profile-new-alpha, 1)) 100%);
  color: inherit;
  padding: 2px 5px;
  border-radius: 6px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  animation: profileNewFade 5s ease forwards;
}
@keyframes profileNewFade {
  0%, 62% { --profile-new-alpha: 1; }
  100%    { --profile-new-alpha: 0; }
}

/* ---------- "Deepen your story" right-hand drawer ---------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 90;
}
.story-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  background: #fff;
  border-left: 4px solid #1a2540;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.25);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.34, 1.1, 0.64, 1);
}
.story-drawer.open { transform: translateX(0); }
.story-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 2px solid #eef0fb;
}
.story-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #FBF8F3;
}
.story-drawer-foot {
  padding: 14px 20px 20px;
  border-top: 2px solid #eef0fb;
}

/* ---------- Resume / LinkedIn quick-add modal ---------- */
.import-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.import-overlay.hidden { display: none; }

/* ---------- "This looks cut off" repair prompt ---------- */
/* Deliberately calmer than an error: the profile is still usable, one paragraph just ends
   early. Only rendered when profileHasTruncatedTail() is true. */
.vibe-truncated {
  border-color: #e6d5f5;
  background: #fbf7ff;
}
.vibe-truncated .vibe-label { color: #7c5cad; }
.vibe-truncated .vibe-value { color: #57407d; font-weight: 600; }

/* ---------- "Synthesis in progress" strip on the My Vibe card ---------- */
/* Shown for the entire merge, from the moment new text is handed to synthesizeProfile
   until the rewritten profile is on the page. Every entry point uses it (chat drawer,
   resume/LinkedIn import, wizard, free-text), not just the drawer - the others used to
   sit silent for the several seconds the call takes. */
.synth-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 2px solid #f7d9bd;
  border-radius: 12px;
  background: #fffaf5;
  color: #c2743a;
  font-size: 13px;
  font-weight: 700;
}
.synth-status.hidden { display: none; }
.synth-spinner {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border: 2px solid #f2c79b;
  border-top-color: #c2743a;
  border-radius: 50%;
  animation: synthSpin 0.7s linear infinite;
}
@keyframes synthSpin { to { transform: rotate(360deg); } }
/* Honour a reduced-motion preference: the strip still reads as busy via the dots. */
@media (prefers-reduced-motion: reduce) {
  .synth-spinner { animation: none; }
}

/* ---------- The optimistic "just shared" tile, shown while synthesis is in flight ---------- */
.vibe-pending {
  border-color: #f7d9bd;
  background: #fffaf5;
}
.vibe-pending .vibe-label { color: #c2743a; }
.vibe-pending .vibe-value { color: #7a5433; }
.vibe-dots::after {
  content: '';
  animation: vibeDots 1.2s steps(4, end) infinite;
}
@keyframes vibeDots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* ---------- Landing walkthrough poster ---------- */
/* The still shown in place of walkthrough.html until it is mounted — see
   mountWalkthrough() in script.js. */
#walkthroughPoster { transition: background-color 0.2s ease; }
#walkthroughPoster:hover { background-color: rgba(255, 255, 255, 0.04); }
#walkthroughPoster .play-chip { transition: transform 0.15s ease; }
#walkthroughPoster:hover .play-chip { transform: scale(1.08); }
