/*
 * css/guest-upsell.css
 *
 * Styles for the guest-mode upsell affordances mounted by
 * js/guest/guest-upsell.js. Two surface kinds: a top-of-viewport
 * banner (expiring / expired guest entries) and an overlay modal
 * (library 1-board cap, AI 20/day cap).
 *
 * Brand-token contract: the brand+SPA agent ships /css/brand-blue.css
 * with the `--brand-blue*` ramp. We `var(--brand-blue, #1e3a8a)` so
 * if that file isn't on disk yet the hardcoded fallback keeps the
 * upsell visually correct in either state. DO NOT inline the brand
 * token values without the var() — that breaks the brand wave's
 * single source of truth.
 *
 * LABEL: PILOT-READY.
 */

/* ── Banner (top of viewport) ─────────────────────────────────── */

.guest-upsell-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "Segoe UI", Roboto, sans-serif;
  font-size: 0.9rem;
  line-height: 1.35;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  /* Tap-target floor for the dismiss button + comfortable touch
     across the banner itself. */
  min-height: 44px;
}

.guest-upsell-banner--expiring {
  background: var(--brand-bg-soft, #fff4d4);
  color: var(--brand-ink, #1a1a2e);
  border-bottom: 2px solid var(--brand-blue-light, #b6caff);
}

.guest-upsell-banner--expired {
  background: #fde2e2;
  color: #5b1010;
  border-bottom: 2px solid #c41e3a;
}

.guest-upsell-banner__msg {
  flex: 1 1 auto;
  text-align: center;
}

.guest-upsell-banner__cta {
  color: var(--brand-blue-dark, #16306a);
  font-weight: 700;
  text-decoration: underline;
  margin-left: 0.4rem;
}

.guest-upsell-banner--expired .guest-upsell-banner__cta {
  color: #6b1212;
}

.guest-upsell-banner__cta:hover,
.guest-upsell-banner__cta:focus-visible {
  color: var(--brand-blue, #1e3a8a);
  outline: 2px solid var(--brand-blue-light, #b6caff);
  outline-offset: 2px;
  border-radius: 4px;
}

.guest-upsell-banner__dismiss {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  padding: 0;
}

.guest-upsell-banner__dismiss:hover,
.guest-upsell-banner__dismiss:focus-visible {
  background: rgba(0, 0, 0, 0.08);
  outline: none;
}

/* When the banner is on, push down the rest of the page so the
   topbar doesn't get covered. Apps that need exact pixel offsets
   can override; this is the safe default. */
body:has(.guest-upsell-banner) {
  padding-top: 52px;
}

/* ── Modal overlay (limit reached / AI quota reached) ─────────── */

.guest-upsell-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(20, 24, 40, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.guest-upsell-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.guest-upsell-modal {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem 1.4rem 1.4rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "Segoe UI", Roboto, sans-serif;
  color: var(--brand-ink, #1a1a2e);
  /* iOS safe-area when the modal lands close to a notched bottom. */
  padding-bottom: max(1.4rem, env(safe-area-inset-bottom));
}

.guest-upsell-title {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 0.7rem;
  color: var(--brand-blue, #1e3a8a);
}

.guest-upsell-body {
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 1.2rem;
  color: var(--brand-ink, #1a1a2e);
}

.guest-upsell-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

@media (min-width: 480px) {
  .guest-upsell-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
}

.guest-upsell-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 140ms ease, color 140ms ease, border 140ms ease;
}

.guest-upsell-btn--primary {
  background: var(--brand-blue, #1e3a8a);
  color: #fff;
}

.guest-upsell-btn--primary:hover,
.guest-upsell-btn--primary:focus-visible {
  background: var(--brand-blue-dark, #16306a);
  color: #fff;
  outline: none;
}

.guest-upsell-btn--ghost {
  background: transparent;
  color: var(--brand-blue, #1e3a8a);
  border-color: transparent;
}

.guest-upsell-btn--ghost:hover,
.guest-upsell-btn--ghost:focus-visible {
  background: var(--brand-bg-soft, #f0f4ff);
  outline: none;
}

/* ── AI quota pill (topbar) ───────────────────────────────────── */

.ai-quota-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1.5px solid var(--brand-blue, #1e3a8a);
  background: var(--brand-bg-soft, #f0f4ff);
  color: var(--brand-blue-dark, #16306a);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  line-height: 1;
  min-height: 36px;
}

.ai-quota-pill:hover,
.ai-quota-pill:focus-visible {
  background: var(--brand-blue, #1e3a8a);
  color: #fff;
  outline: none;
}

.ai-quota-pill--warn {
  border-color: #d97706;
  background: #fff4d4;
  color: #6b3a00;
}

.ai-quota-pill--warn:hover,
.ai-quota-pill--warn:focus-visible {
  background: #d97706;
  color: #fff;
}

.ai-quota-pill--blocked {
  border-color: #c41e3a;
  background: #fde2e2;
  color: #5b1010;
}

.ai-quota-pill[hidden] {
  display: none !important;
}

/* Tighter on phone viewports — the topbar is already pill-heavy. */
@media (max-width: 480px) {
  .ai-quota-pill {
    padding: 0.35rem 0.55rem;
    font-size: 0.72rem;
    min-height: 32px;
  }
  .guest-upsell-banner {
    font-size: 0.82rem;
    padding: 0.5rem 0.7rem;
  }
}
