/* CalcVibe shared styles — new shared components + global accessibility fixes.
   Loaded after each page's inline <style> so these rules win on equal specificity.
   Uses the --accent / --ink-light / --accent-light variables each page defines. */

/* ---- Skip link (keyboard users jump past the nav to the calculator) ---- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ---- Visible focus for keyboard navigation ---- */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
.mode-btn:focus-visible,
.accordion-header:focus-visible {
  outline: 3px solid rgba(26, 107, 60, 0.45);
  outline-offset: 2px;
}

/* ---- SEO intro paragraph below page heading ---- */
.calc-intro {
  max-width: 600px;
  margin: 1rem auto 0;
  color: var(--ink-light);
  font-size: 0.9rem;
  line-height: 1.7;
  font-weight: 400;
}

/* ---- Persistent helper text under inputs (RULES.md: tooltips on every field) ---- */
.input-help {
  display: block;
  font-size: 0.72rem;
  line-height: 1.45;
  font-weight: 400;
  color: var(--ink-light);
  margin-top: 0.4rem;
}

/* ---- Copy / share actions below results ---- */
.result-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.btn-action {
  font-family: 'Epilogue', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  border: 1.5px solid transparent;
  border-radius: 9px;
  padding: 0.6rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-action:hover { border-color: var(--accent); }
.btn-action.is-copied { background: var(--accent); color: #fff; }

/* ---- Contrast fixes (previously failed WCAG AA) ---- */
.footer-disclaimer { color: #6b6b7a; }
.result-label { color: rgba(255, 255, 255, 0.72); }
.about-text { color: rgba(255, 255, 255, 0.7); }

/* ---- Tooltips / info popups (RULES.md > UI Components) ----
   Info popups must clear all surrounding content and never be clipped by the
   card/panel they sit in. z-index alone is not enough: the real cause is
   overflow:hidden on the surrounding cards, which clips a popup that extends
   beyond the card edge. So we (a) raise the popup above everything and
   (b) stop the containing cards/accordions clipping an open popup. */
.tip-box,
.res-tip-box,
.chart-tooltip { z-index: 9999; }

/* Panels that hold info popups must not clip them. */
.results-card { overflow: visible; }

/* Accordions keep overflow:hidden while collapsed (so they can animate closed),
   but must reveal popups once open. */
.accordion.open,
.accordion.open .accordion-body { overflow: visible; }

/* ---- Auth nav widget ---- */
.cva-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* Signed-out: "Sign in" pill */
.cva-signin-btn {
  font-family: 'Epilogue', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border: 1.5px solid transparent;
  padding: 7px 18px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1;
}
.cva-signin-btn:hover { background: #d0eadb; border-color: var(--accent); }

/* Signed-in: avatar + email + chevron */
.cva-account-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 5px 12px 5px 5px;
  cursor: pointer;
  font-family: 'Epilogue', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.15s;
}
.cva-account-btn:hover,
.cva-account-btn--open { background: #155c33; }

.cva-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Epilogue', sans-serif;
}

.cva-email-short {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cva-chevron {
  font-size: 0.65rem;
  opacity: 0.75;
}

/* Dropdown */
.cva-drop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(26, 26, 46, 0.13);
  z-index: 9999;
  overflow: hidden;
}

.cva-drop-email {
  padding: 12px 16px 4px;
  font-size: 0.8rem;
  color: var(--ink-light);
  word-break: break-all;
}

.cva-drop-sync {
  padding: 2px 16px 10px;
  font-size: 0.76rem;
  color: var(--accent);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cva-sync-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.cva-drop-divider {
  height: 1px;
  background: var(--border);
}

.cva-drop-signout {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  font-family: 'Epilogue', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s;
}
.cva-drop-signout:hover { background: #f7f6f2; }

/* ---- Auth modal overlay ---- */
.cva-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.6);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.cva-overlay.cva-open { display: flex; }

/* ---- Modal card ---- */
.cva-modal {
  background: #fff;
  border-radius: 14px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: 0 24px 64px rgba(26, 26, 46, 0.2);
  animation: cva-pop 0.18s ease;
}
@keyframes cva-pop {
  from { transform: translateY(8px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0)   scale(1);    opacity: 1; }
}

.cva-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: #9b9baa;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.12s, background 0.12s;
}
.cva-close:hover { color: var(--ink); background: #f7f6f2; }

/* Value proposition */
.cva-value-prop {
  margin-bottom: 1.4rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.cva-vp-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.3rem;
}
.cva-vp-sub {
  font-size: 0.82rem;
  color: var(--ink-light);
  line-height: 1.55;
  margin-bottom: 0.7rem;
}
.cva-vp-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cva-vp-list li {
  font-size: 0.79rem;
  color: var(--accent);
  font-weight: 500;
}
.cva-vp-list li::before {
  content: '✓  ';
  font-weight: 700;
}

/* Tabs */
.cva-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.2rem;
}
.cva-tab {
  background: none;
  border: none;
  font-family: 'Epilogue', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-light);
  padding: 0 0 10px;
  margin-right: 1.5rem;
  margin-bottom: -2px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.cva-tab--active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
}
.cva-tab:hover:not(.cva-tab--active) { color: var(--ink); }

/* Message */
.cva-msg {
  font-size: 0.82rem;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  line-height: 1.45;
}
.cva-msg--err { background: #fdecea; color: #b71c1c; }
.cva-msg--ok  { background: var(--accent-light); color: #0d5a30; }

/* Form fields */
.cva-field { margin-bottom: 0.85rem; }
.cva-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.3rem;
}
.cva-field input {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Epilogue', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.cva-field input:focus { border-color: var(--accent); }
.cva-field input::placeholder { color: #b8b7c3; }

/* Submit button */
.cva-submit {
  width: 100%;
  padding: 0.7rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Epilogue', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
  transition: background 0.15s;
}
.cva-submit:hover:not(:disabled) { background: #155c33; }
.cva-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Mobile */
@media (max-width: 480px) {
  .cva-modal { padding: 1.5rem; border-radius: 12px; }
  .cva-email-short { max-width: 80px; }
}
