/* ============================================================
   Ujeebu v3 — design system
   Ported from Ujb-claude-design (shared-v2.jsx). Single source of
   truth for tokens + reusable component classes. Page-specific
   layout lives in per-page stylesheets.
   ============================================================ */

:root {
  /* ----- palette (UJ2) ----- */
  --uj-ink:        #0B0F19;
  --uj-ink2:       #1F2937;
  --uj-muted:      #6B7280;
  --uj-muted2:     #9CA3AF;
  --uj-line:       #E5E7EB;
  --uj-line2:      #F3F4F6;
  --uj-paper:      #FAFAF7;
  --uj-surface:    #FFFFFF;
  --uj-accent:     #F97316;
  --uj-accent2:    #EA580C;
  --uj-accent-soft:#FFF4ED;
  --uj-accent-ink: #9A3412;
  --uj-green:      #16A34A;
  --uj-green-soft: #ECFDF5;
  --uj-blue:       #2563EB;
  --uj-blue-soft:  #EFF6FF;
  --uj-red:        #DC2626;
  --uj-red-soft:   #FEF2F2;

  /* ----- type ----- */
  --uj-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --uj-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  /* ----- radius / shadow ----- */
  --uj-r-sm: 8px;
  --uj-r-md: 10px;
  --uj-r-lg: 14px;
  --uj-r-xl: 16px;
  --uj-shadow-card: 0 1px 2px rgba(15,23,42,0.04);
  --uj-shadow-pop:  0 12px 40px rgba(15,23,42,0.10), 0 2px 8px rgba(15,23,42,0.06);

  --uj-maxw: 1280px;
}

/* ============================================================
   Reset / base — scoped to .uj-v3 so it never touches legacy
   v2 pages still on the old design.
   ============================================================ */
.uj-v3 *, .uj-v3 *::before, .uj-v3 *::after { box-sizing: border-box; }

.uj-v3 {
  margin: 0;
  background: var(--uj-surface);
  color: var(--uj-ink);
  font-family: var(--uj-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.uj-v3 ::selection { background: #FFD3B5; color: #1F2937; }
.uj-v3 a { color: inherit; text-decoration: none; }
.uj-v3 a:hover { color: var(--uj-accent); }
/* Filled-button anchors keep white text on hover — the global a:hover
   above has higher specificity than .uj-btn--primary:hover otherwise. */
.uj-v3 a.uj-btn--primary, .uj-v3 a.uj-btn--primary:hover,
.uj-v3 a.uj-btn--dark,    .uj-v3 a.uj-btn--dark:hover { color: #fff; }
.uj-v3 img { max-width: 100%; }
.uj-v3 h1, .uj-v3 h2, .uj-v3 h3, .uj-v3 h4, .uj-v3 p { margin: 0; }

.uj-v3 ::-webkit-scrollbar { height: 8px; width: 8px; }
.uj-v3 ::-webkit-scrollbar-thumb { background: var(--uj-line); border-radius: 4px; }
.uj-v3 ::-webkit-scrollbar-thumb:hover { background: #D1D5DB; }

/* ============================================================
   Layout helpers
   ============================================================ */
.uj-container { max-width: var(--uj-maxw); margin: 0 auto; padding: 0 28px; }
.uj-stack    { display: flex; flex-direction: column; }
.uj-row      { display: flex; align-items: center; }
.uj-spacer   { flex: 1; }

/* ============================================================
   Headings — H component (Inter display weights)
   ============================================================ */
.uj-h        { margin: 0; font-family: var(--uj-sans); font-weight: 600; color: var(--uj-ink); text-wrap: balance; }
.uj-h--xs    { font-size: clamp(26px, 2.6vw, 32px);  line-height: 1.15; letter-spacing: -0.02em; }
.uj-h--sm    { font-size: clamp(30px, 3vw, 40px);    line-height: 1.12; letter-spacing: -0.025em; }
.uj-h--md    { font-size: clamp(36px, 3.6vw, 52px);  line-height: 1.08; letter-spacing: -0.03em; }
.uj-h--lg    { font-size: clamp(46px, 4.6vw, 68px);  line-height: 1.04; letter-spacing: -0.035em; }
.uj-h--xl    { font-size: clamp(58px, 5.8vw, 88px);  line-height: 1.02; letter-spacing: -0.04em; }
.uj-h--mono  { font-family: var(--uj-mono); font-weight: 500; }
.uj-accent-text { color: var(--uj-accent); }

/* ============================================================
   Eyebrow — small uppercase label with dot
   ============================================================ */
.uj-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--uj-accent);
  letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.uj-eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}

/* ============================================================
   Buttons — Btn component (kinds + sizes)
   ============================================================ */
.uj-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--uj-sans); font-weight: 500; line-height: 1;
  border: 1px solid transparent; border-radius: var(--uj-r-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}
.uj-btn:hover { color: inherit; }
.uj-btn:active { transform: translateY(1px); }

.uj-btn--sm { padding: 8px 12px;  height: 32px; font-size: 13px; }
.uj-btn--md { padding: 10px 16px; height: 40px; font-size: 14px; }
.uj-btn--lg { padding: 12px 20px; height: 48px; font-size: 15px; }

.uj-btn--primary {
  background: var(--uj-accent); color: #fff; border-color: var(--uj-accent);
  box-shadow: 0 1px 2px rgba(154,52,18,0.25), inset 0 -1px 0 rgba(0,0,0,0.08);
}
.uj-btn--primary:hover { background: var(--uj-accent2); border-color: var(--uj-accent2); color: #fff; }
.uj-btn--dark    { background: var(--uj-ink); color: #fff; border-color: var(--uj-ink); box-shadow: 0 1px 2px rgba(0,0,0,0.18); }
.uj-btn--dark:hover { background: #000; color: #fff; }
.uj-btn--ghost   { background: #fff; color: var(--uj-ink); border-color: var(--uj-line); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.uj-btn--ghost:hover { border-color: var(--uj-accent); background: var(--uj-accent-soft); color: var(--uj-ink); }
.uj-btn--soft    { background: var(--uj-accent-soft); color: var(--uj-accent-ink); }
.uj-btn--soft:hover { background: #FFE9D8; color: var(--uj-accent-ink); }
.uj-btn--bare    { background: transparent; color: var(--uj-ink); }
.uj-btn--bare:hover { background: var(--uj-line2); color: var(--uj-ink); }
.uj-btn--block   { width: 100%; }

/* ============================================================
   Card surface
   ============================================================ */
.uj-card {
  background: #fff; border: 1px solid var(--uj-line); border-radius: var(--uj-r-lg);
  box-shadow: var(--uj-shadow-card);
}
.uj-card--hover { transition: border-color .12s, box-shadow .12s, transform .12s; }
.uj-card--hover:hover {
  border-color: #FED7AA; box-shadow: 0 8px 24px rgba(15,23,42,0.06); transform: translateY(-2px);
}

/* ============================================================
   Chip / badge
   ============================================================ */
.uj-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  font-family: var(--uj-sans); white-space: nowrap; border: 1px solid transparent;
}
.uj-chip--neutral { background: var(--uj-line2); color: var(--uj-ink2); }
.uj-chip--orange  { background: var(--uj-accent-soft); color: var(--uj-accent-ink); }
.uj-chip--green   { background: var(--uj-green-soft); color: #15803D; }
.uj-chip--blue    { background: var(--uj-blue-soft); color: #1D4ED8; }
.uj-chip--ink     { background: var(--uj-ink); color: #fff; }
.uj-chip--outline { background: #fff; color: var(--uj-ink); border-color: var(--uj-line); }

/* ============================================================
   Icon tile — tinted square holding a line icon
   ============================================================ */
.uj-icon-tile {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--uj-r-md); flex-shrink: 0;
}
.uj-icon-tile--orange { background: var(--uj-accent-soft); color: var(--uj-accent); }
.uj-icon-tile--blue   { background: var(--uj-blue-soft);   color: var(--uj-blue); }
.uj-icon-tile--green  { background: var(--uj-green-soft);  color: var(--uj-green); }
.uj-icon-tile--red    { background: var(--uj-red-soft);    color: var(--uj-red); }
.uj-icon-tile--ink    { background: var(--uj-line2);       color: var(--uj-ink); }

/* line icon stroke defaults */
.uj-icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ============================================================
   Form fields
   ============================================================ */
.uj-field {
  width: 100%; padding: 12px 14px; background: #fff;
  border: 1px solid var(--uj-line); border-radius: var(--uj-r-md);
  font-family: var(--uj-sans); font-size: 14px; color: var(--uj-ink); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.uj-field::placeholder { color: var(--uj-muted2); }
.uj-field:focus { border-color: var(--uj-accent); box-shadow: 0 0 0 3px rgba(249,115,22,0.12); }
.uj-label { font-family: var(--uj-sans); font-size: 12.5px; color: var(--uj-ink2); font-weight: 500; }

/* divider with centered label */
.uj-divider { display: flex; align-items: center; gap: 14px; color: var(--uj-muted2); }
.uj-divider::before, .uj-divider::after { content: ""; flex: 1; height: 1px; background: var(--uj-line); }
.uj-divider > span {
  font-family: var(--uj-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
}

/* ============================================================
   Logo wordmark
   ============================================================ */
.uj-logo { display: inline-flex; align-items: center; gap: 9px; color: var(--uj-ink); }
.uj-logo img { display: block; width: 26px; height: 26px; object-fit: contain; }
.uj-logo span { font-family: var(--uj-sans); font-weight: 700; font-size: 19px; letter-spacing: -0.025em; }
/* logo never takes the global accent-on-hover */
.uj-v3 .uj-logo:hover, .uj-v3 .uj-logo:hover span { color: var(--uj-ink); }

/* ============================================================
   Utility text
   ============================================================ */
.uj-mono  { font-family: var(--uj-mono); }
.uj-muted { color: var(--uj-muted); }
.uj-small { font-size: 13px; }

@media (max-width: 720px) {
  .uj-container { padding: 0 18px; }
}

/* ============================================================
   Cookie consent notice — compact bottom-left card
   ============================================================ */
.uj-v3 .uj-cookie {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 1200;
  width: 384px;
  max-width: calc(100vw - 32px);
  display: flex;
  gap: 13px;
  padding: 18px;
  background: var(--uj-surface);
  border: 1px solid var(--uj-line);
  border-radius: var(--uj-r-lg);
  box-shadow: var(--uj-shadow-pop);
  font-family: var(--uj-sans);
  transform: translateY(16px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
}
.uj-v3 .uj-cookie.is-in { transform: translateY(0); opacity: 1; }
.uj-v3 .uj-cookie.is-hidden { transform: translateY(16px); opacity: 0; }
.uj-v3 .uj-cookie-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--uj-accent-soft);
  color: var(--uj-accent);
}
.uj-v3 .uj-cookie-icon svg { width: 20px; height: 20px; }
.uj-v3 .uj-cookie-body { min-width: 0; padding-right: 14px; }
.uj-v3 .uj-cookie-title {
  font-size: 14.5px; font-weight: 700; color: var(--uj-ink); letter-spacing: -0.01em;
}
.uj-v3 .uj-cookie-text {
  margin: 5px 0 0;
  font-size: 12.5px; line-height: 1.55; color: var(--uj-muted);
}
.uj-v3 .uj-cookie-text a { color: var(--uj-accent); }
.uj-v3 .uj-cookie-text a:hover { text-decoration: underline; }
.uj-v3 .uj-cookie-actions { margin-top: 14px; display: flex; gap: 8px; }
.uj-v3 .uj-cookie-x {
  position: absolute; top: 11px; right: 11px;
  width: 25px; height: 25px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--uj-muted2); cursor: pointer;
}
.uj-v3 .uj-cookie-x svg { width: 15px; height: 15px; }
.uj-v3 .uj-cookie-x:hover { background: var(--uj-line2); color: var(--uj-ink); }
/* auth split-screen has its form in the bottom-left — keep the notice clear of it */
.uj-v3.uj-auth .uj-cookie { left: auto; right: 24px; }
@media (max-width: 480px) {
  .uj-v3 .uj-cookie, .uj-v3.uj-auth .uj-cookie { left: 14px; right: 14px; bottom: 14px; width: auto; }
}

/* ============================================================
   Toast notifications — top-right stack (v3 ujeebuNotification)
   ============================================================ */
.uj-v3 .uj-toasts {
  position: fixed;
  top: 80px; right: 20px;
  z-index: 1300;
  display: flex; flex-direction: column; gap: 10px;
  width: 364px; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.uj-v3 .uj-toast {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 14px;
  background: var(--uj-surface);
  border: 1px solid var(--uj-line);
  border-left: 3px solid var(--uj-muted2);
  border-radius: var(--uj-r-md);
  box-shadow: var(--uj-shadow-pop);
  font-family: var(--uj-sans);
  pointer-events: auto;
  transform: translateX(120%);
  transition: transform .32s cubic-bezier(.22,.61,.36,1), opacity .25s ease;
}
.uj-v3 .uj-toast.is-in { transform: translateX(0); }
.uj-v3 .uj-toast.is-out { transform: translateX(120%); opacity: 0; }
.uj-v3 .uj-toast-ico {
  flex-shrink: 0; width: 19px; height: 19px; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
}
.uj-v3 .uj-toast-ico svg { width: 19px; height: 19px; }
.uj-v3 .uj-toast-msg {
  flex: 1; min-width: 0;
  font-size: 13.5px; line-height: 1.5; color: var(--uj-ink2);
}
.uj-v3 .uj-toast-msg a { color: var(--uj-accent); }
.uj-v3 .uj-toast-x {
  flex-shrink: 0; width: 21px; height: 21px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 5px;
  color: var(--uj-muted2); cursor: pointer;
}
.uj-v3 .uj-toast-x svg { width: 14px; height: 14px; }
.uj-v3 .uj-toast-x:hover { color: var(--uj-ink); background: var(--uj-line2); }
.uj-v3 .uj-toast--success { border-left-color: var(--uj-green); }
.uj-v3 .uj-toast--success .uj-toast-ico { color: var(--uj-green); }
.uj-v3 .uj-toast--error { border-left-color: var(--uj-red); }
.uj-v3 .uj-toast--error .uj-toast-ico { color: var(--uj-red); }
.uj-v3 .uj-toast--info { border-left-color: var(--uj-blue); }
.uj-v3 .uj-toast--info .uj-toast-ico { color: var(--uj-blue); }
@media (max-width: 480px) {
  .uj-v3 .uj-toasts { top: 70px; right: 12px; left: 12px; width: auto; }
}

/* ============================================================
   SweetAlert2 — v3 theme (auth dialogs, validation popups, etc.)
   Popups append under <body class="uj-v3"> so .uj-v3 prefixes win
   over SweetAlert's own rules. Button colours need !important
   because SweetAlert sets them as inline styles.
   ============================================================ */
.uj-v3 .swal2-popup {
  width: 30em;
  max-width: 92vw;
  padding: 28px 28px 24px;
  border: 1px solid var(--uj-line);
  border-radius: var(--uj-r-xl);
  box-shadow: var(--uj-shadow-pop);
  font-family: var(--uj-sans);
}
.uj-v3 .swal2-title {
  margin: 6px 0 0;
  padding: 0;
  font-family: var(--uj-sans);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--uj-ink);
}
.uj-v3 .swal2-content,
.uj-v3 .swal2-html-container {
  font-family: var(--uj-sans);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--uj-muted);
}
.uj-v3 .swal2-actions { margin: 22px 0 0; gap: 10px; }
.uj-v3 .swal2-styled {
  margin: 0;
  padding: 10px 20px;
  border-radius: var(--uj-r-md);
  font-family: var(--uj-sans);
  font-size: 14px;
  font-weight: 600;
  box-shadow: none;
  transition: background-color .15s ease;
}
.uj-v3 .swal2-styled.swal2-confirm {
  background-color: var(--uj-accent) !important;
  color: #fff !important;
}
.uj-v3 .swal2-styled.swal2-confirm:hover { background-color: var(--uj-accent2) !important; }
.uj-v3 .swal2-styled.swal2-cancel {
  background-color: #fff !important;
  color: var(--uj-ink) !important;
  border: 1px solid var(--uj-line) !important;
}
.uj-v3 .swal2-styled.swal2-cancel:hover { background-color: var(--uj-line2) !important; }
.uj-v3 .swal2-styled:focus { box-shadow: 0 0 0 3px var(--uj-accent-soft) !important; }
.uj-v3 .swal2-close {
  font-size: 26px;
  color: var(--uj-muted2);
  transition: color .15s ease;
}
.uj-v3 .swal2-close:hover { color: var(--uj-ink); }

/* icons recoloured to the v3 palette */
.uj-v3 .swal2-icon { margin: 6px auto 10px; }
.uj-v3 .swal2-icon.swal2-warning { border-color: #FCD9BE; color: var(--uj-accent); }
.uj-v3 .swal2-icon.swal2-error { border-color: #FECACA; color: var(--uj-red); }
.uj-v3 .swal2-icon.swal2-error [class^='swal2-x-mark-line'] { background-color: var(--uj-red); }
.uj-v3 .swal2-icon.swal2-success { border-color: #BBF7D0; color: var(--uj-green); }
.uj-v3 .swal2-icon.swal2-success [class^='swal2-success-line'] { background-color: var(--uj-green); }
.uj-v3 .swal2-icon.swal2-success .swal2-success-ring { border-color: #BBF7D0; }
.uj-v3 .swal2-icon.swal2-info { border-color: #BFDBFE; color: var(--uj-blue); }
.uj-v3 .swal2-icon.swal2-question { border-color: var(--uj-line); color: var(--uj-muted); }

/* ============================================================
 *  Logged-in CTA suppression
 * ============================================================
 *  When the visitor is authenticated, the "Start free" / "Get API key" /
 *  "Get your free API key" CTAs become noise — they're inviting a signup
 *  that's already happened. body.is-logged-in (set by front-v3 layout) acts
 *  as a global flag; we hide every signup-link variant in one place.
 *
 *  The selector covers:
 *    - Any <a> pointing at /signup or /signup?...
 *    - Hidden anchors (no display:none collisions to worry about — these
 *      have no other rule that wins, so a single rule is enough).
 *
 *  Parent containers ("signup row" with multiple buttons) collapse naturally
 *  to whatever's left; if a row becomes empty it just renders 0-height.
 */
body.is-logged-in a[href="/signup"],
body.is-logged-in a[href^="/signup?"],
body.is-logged-in a[href^="/signup/"] {
  display: none !important;
}

/* Playground: collapse the entire signup-CTA surfaces (not just the button
   inside) when logged in — the headline ("Liked what you saw?" / "Get your
   free API key.") only makes sense pre-signup. */
body.is-logged-in .ujpg-cta-static,
body.is-logged-in #ujpg-cta-static,
body.is-logged-in .ujpg-conv-signup {
  display: none !important;
}
