/* =========================================================
   JarvisX — Dark + Glossy Gold Upstash-inspired Theme
   Non-breaking visual overrides only (no functional changes)
   Path: /static/assets/ux-theme.css
   ========================================================= */

/* --------- Base Colors / Tokens --------- */
:root {
  --jx-bg: #0a0a0a;
  --jx-surface: #101010;
  --jx-surface-2: #141414;
  --jx-surface-3: #0e0e0e;
  --jx-text: #f5f5f5;
  --jx-text-dim: #cdcdcd;
  --jx-border: #232323;
  --jx-gold-1: #ffe57a;
  --jx-gold-2: #ffd84d;
  --jx-gold-3: #e6c200;
  --jx-gold-4: #b69500;
  --jx-gold-5: #8a6f00;
  --jx-gold-glow: rgba(230, 194, 0, 0.35);
}

/* --------- Global Resets --------- */
html, body {
  background: var(--jx-bg) !important;
  color: var(--jx-text) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body, input, button, select, textarea {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji" !important;
}

/* --------- Typography --------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--jx-text) !important;
  letter-spacing: .2px;
}
p, li, dt, dd, small, span, label {
  color: var(--jx-text-dim) !important;
}

/* --------- Nav / Header (glass) --------- */
nav, header, .navbar, .topbar, .app-bar {
  background: rgba(10,10,10,.7) !important;
  border-bottom: 1px solid var(--jx-border) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* --------- Hero Section (first primary container/section) --------- */
main > section:first-of-type,
.container:first-of-type,
.hero, header + main .container:first-of-type {
  position: relative;
  background: radial-gradient(60% 60% at 50% 0%, rgba(230,194,0,0.15), rgba(0,0,0,0)) !important;
  border-radius: 18px;
}
.hero, .jx-hero {
  text-align: center;
  padding: 80px 20px;
}
.jx-hero .hero-title, .hero .hero-title, h1.page-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 900;
  margin-bottom: 12px;
}
.jx-hero .hero-subtitle, .hero .hero-subtitle, .page-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--jx-text-dim);
  margin-bottom: 36px;
}

/* --------- Surfaces / Cards --------- */
.card, .panel, .widget, .tile, .box, .well,
div[class*="card"], section[class*="card"], article[class*="card"],
div[class*="panel"], section[class*="panel"], article[class*="panel"] {
  background: linear-gradient(180deg, var(--jx-surface), var(--jx-surface-2)) !important;
  border: 1px solid var(--jx-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.02) !important;
}

/* Decorative gold edge (optional) */
.card.jx-gold, .panel.jx-gold {
  border-image: linear-gradient(180deg, var(--jx-gold-3), var(--jx-gold-5)) 1 !important;
}

/* --------- Buttons (force override) --------- */
button, .btn, input[type="button"], input[type="submit"], .Button, .PrimaryButton,
a.btn, a.button, .btn-primary, .btn-default, .btn-lg, .btn-sm {
  background: linear-gradient(135deg, var(--jx-gold-2), var(--jx-gold-3)) !important;
  color: #0a0a0a !important;
  border: 1px solid var(--jx-gold-4) !important;
  border-radius: 12px !important;
  font-weight: 700 !important;
  letter-spacing: .2px !important;
  padding: 10px 20px !important;
  transition: transform .08s ease, box-shadow .2s ease, filter .2s ease !important;
  text-decoration: none !important;
}
button:hover, .btn:hover, input[type="button"]:hover, input[type="submit"]:hover,
a.btn:hover, .btn-primary:hover, .btn-default:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 28px var(--jx-gold-glow) !important;
  transform: translateY(-2px);
}
button:active, .btn:active { transform: translateY(0) !important; }

/* Outline / Ghost buttons */
.btn-outline, .Button--secondary, .ghost, .btn-secondary, a.outline-btn {
  background: transparent !important;
  color: var(--jx-gold-2) !important;
  border: 1.5px solid var(--jx-gold-4) !important;
}
.btn-outline:hover, .Button--secondary:hover, .ghost:hover, .btn-secondary:hover, a.outline-btn:hover {
  background: rgba(230,194,0,0.08) !important;
  box-shadow: 0 6px 24px var(--jx-gold-glow) !important;
}

/* Links */
a { color: var(--jx-gold-2) !important; }
a:hover { color: var(--jx-gold-1) !important; text-decoration-color: var(--jx-gold-1) !important; }

/* --------- Forms / Inputs --------- */
input, select, textarea, .input, .form-control, .TextField, .Select, .Textarea {
  background: #0f0f0f !important;
  color: var(--jx-text) !important;
  border: 1px solid var(--jx-border) !important;
  border-radius: 10px !important;
  outline: none !important;
  box-shadow: none !important;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--jx-gold-3) !important;
  box-shadow: 0 0 0 3px var(--jx-gold-glow) !important;
}
label { color: var(--jx-text-dim) !important; }

/* Switches / Checkboxes / Radios */
input[type="checkbox"], input[type="radio"], input[type="range"] {
  accent-color: var(--jx-gold-2) !important;
}

/* --------- Tables --------- */
table, .table { color: var(--jx-text) !important; border-color: var(--jx-border) !important; }
thead, th {
  background: #121212 !important;
  color: var(--jx-text) !important;
}
tbody tr { border-bottom: 1px solid var(--jx-border) !important; }
tbody tr:hover { background: #0f0f0f !important; }

/* --------- Code / Pre --------- */
pre, code, .code, .hljs {
  background: #0f0f0f !important;
  color: var(--jx-text) !important;
  border: 1px solid var(--jx-border) !important;
  border-radius: 10px !important;
}

/* --------- Alerts / Toasts --------- */
.alert, .toast, .notification, .message {
  background: linear-gradient(180deg, #101010, #0c0c0c) !important;
  border: 1px solid var(--jx-gold-4) !important;
  color: var(--jx-text) !important;
  border-radius: 12px !important;
}

/* --------- Utility classes --------- */
.gold-text { color: var(--jx-gold-1) !important; }
.gold-gradient { background: linear-gradient(135deg, var(--jx-gold-2), var(--jx-gold-3)) !important; color: #0a0a0a !important; }
.glow { box-shadow: 0 0 0 2px var(--jx-gold-glow), 0 10px 30px rgba(0,0,0,.45) !important; }
.surface { background: linear-gradient(180deg, var(--jx-surface), var(--jx-surface-2)) !important; border: 1px solid var(--jx-border) !important; border-radius: 14px !important; }
.hr-gold { border: none; height: 1px; background: linear-gradient(90deg, rgba(0,0,0,0), var(--jx-border), rgba(0,0,0,0)) !important; }
.spacious { padding: 24px !important; }
.rounded-xl { border-radius: 16px !important; }

/* --------- Footer --------- */
footer { border-top: 1px solid var(--jx-border) !important; background: #090909 !important; }


/* ===== Upstash-aligned page composition tweaks ===== */
main.spacious { max-width: 1100px; margin: 0 auto; }

.jx-hero.hero {
  margin: 24px auto 6px;
}
.jx-hero .hero-title {
  background: linear-gradient(90deg, var(--jx-text) 0%, var(--jx-gold-1) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.jx-hero .hero-subtitle {
  opacity: .9;
}

/* Feature cards grid (if used) */
.jx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.jx-card {
  padding: 18px;
}

/* Tighten table visuals */
.table thead th, thead th { font-weight: 700 !important; }
.table td, .table th, td, th { padding: 10px 12px !important; }

/* Buttons in groups */
.button-container .btn { margin: 8px; }


/* ===== Logo & Footer Enhancements ===== */
footer a { color: var(--jx-gold-2) !important; text-decoration: none; }
footer a:hover { text-decoration: underline; color: var(--jx-gold-1) !important; }

/* ===== Brand + Footer ===== */
.nav-brand {
  display: flex; align-items: center; gap: 10px;
}
.nav-brand img { height: 28px; width: auto; display: block; }
.nav-brand .brand-title { font-weight: 800; letter-spacing: .3px; }

footer.jx-footer {
  margin-top: 40px;
  padding: 26px 0;
  border-top: 1px solid var(--jx-border) !important;
  background: linear-gradient(180deg, #0a0a0a, #090909) !important;
}
.jx-footer .footer-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 16px;
  display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 18px;
}
.jx-footer h4 { margin: 0 0 10px; color: var(--jx-text); }
.jx-footer a { color: var(--jx-gold-2); text-decoration: none; }
.jx-footer a:hover { color: var(--jx-gold-1); }
.jx-footer .muted { color: var(--jx-text-dim); font-size: .95rem; }
.jx-footer .copyright { grid-column: 1 / -1; opacity: .8; margin-top: 10px; }
@media (max-width: 840px) {
  .jx-footer .footer-inner { grid-template-columns: 1fr; }
}

/* ===== Animated Hero Glow ===== */
.jx-hero {
  position: relative;
  overflow: hidden;
}
.jx-hero::before {
  content: "";
  position: absolute;
  top: -40%; left: -40%;
  width: 180%; height: 180%;
  background: radial-gradient(circle, rgba(230,194,0,0.15) 0%, transparent 60%);
  animation: heroGlow 12s ease-in-out infinite alternate;
  z-index: 0;
}
.jx-hero > * { position: relative; z-index: 1; }

@keyframes heroGlow {
  0% { transform: translate(0,0) scale(1); opacity:.8; }
  50% { transform: translate(8%,6%) scale(1.05); opacity:1; }
  100% { transform: translate(-6%,-4%) scale(1.03); opacity:.7; }
}

/* ===== Scroll Reveal Animations ===== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Hero animated glow ===== */
.jx-hero.hero::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 60vmin;
  height: 60vmin;
  background: radial-gradient(circle, rgba(230,194,0,0.20), rgba(230,194,0,0) 60%);
  filter: blur(28px);
  pointer-events: none;
  animation: jxGlow 6s ease-in-out infinite;
  opacity: .8;
}
@keyframes jxGlow {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1.0); opacity: .75; }
  50%      { transform: translateX(-50%) translateY(6px) scale(1.05); opacity: .95; }
}

/* ===== Scroll reveal (JS-enhanced; progressive) ===== */
.will-reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal-in {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Slight stagger when a grid is present */
.jx-grid .will-reveal { transition-delay: .05s; }
.jx-grid .will-reveal:nth-child(2) { transition-delay: .10s; }
.jx-grid .will-reveal:nth-child(3) { transition-delay: .15s; }
.jx-grid .will-reveal:nth-child(4) { transition-delay: .20s; }

.gold-border { border: 1px solid var(--jx-gold-4) !important; border-radius: 12px !important; }
.muted { color: var(--jx-text-dim) !important; }
.codewrap pre { padding: 14px; overflow: auto; }

/* Testimonials */
.jx-grid .card p { font-size: 1rem; margin-bottom: 6px; }
.jx-grid .card span { font-size: .9rem; }

/* Logos sizing niceties */
.jx-grid img { opacity: .9; filter: saturate(0.9); transition: transform .2s ease, opacity .2s ease; }
.jx-grid img:hover { transform: translateY(-2px) scale(1.02); opacity: 1; }

/* Testimonials tone */
.jx-card p { margin: 0 0 8px; font-size: 1rem; }
.jx-card .muted { font-size: .95rem; }

/* Active nav link highlight */
.nav-right a.active {
  color: var(--jx-gold-1) !important;
  font-weight: 700 !important;
  border-bottom: 2px solid var(--jx-gold-2);
  padding-bottom: 2px;
}

/* Nav link hover transitions */
.nav-right a {
  position: relative;
  transition: color .25s ease;
}
.nav-right a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 2px;
  background: var(--jx-gold-2);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .25s ease;
}
.nav-right a:hover {
  color: var(--jx-gold-1) !important;
}
.nav-right a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}
/* Ensure active state still shows underline */
.nav-right a.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Premium nav hover transitions */
.nav-right a {
  position: relative;
  display: inline-block;
  margin-left: 14px;
  padding-bottom: 2px;
  transition: color .2s ease;
}
.nav-right a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: linear-gradient(90deg, var(--jx-gold-5), var(--jx-gold-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.nav-right a:hover { color: var(--jx-gold-1) !important; }
.nav-right a:hover::after { transform: scaleX(1); }
.nav-right a.active::after { transform: scaleX(1); }

/* Accessibility: keyboard focus styles for nav links */
.nav-right a:focus {
  outline: none;
  color: var(--jx-gold-1) !important;
}
.nav-right a:focus::after {
  transform: scaleX(1);
}
.nav-right a:focus-visible {
  box-shadow: 0 0 0 2px var(--jx-gold-3), 0 0 8px var(--jx-gold-1);
  border-radius: 4px;
}

/* =========================================================
   Site-wide polish & accessibility
   ========================================================= */

/* Global focus for links & buttons */
a, button, .btn, input[type="button"], input[type="submit"] {
  outline: none;
}
a:focus-visible, button:focus-visible, .btn:focus-visible,
input[type="button"]:focus-visible, input[type="submit"]:focus-visible {
  box-shadow: 0 0 0 2px var(--jx-gold-3), 0 0 8px var(--jx-gold-1) !important;
  border-radius: 6px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Skip link */
.skip-link {
  position: absolute; left: 8px; top: 8px;
  padding: 8px 12px; background: #0f0f0f; color: var(--jx-gold-1);
  border: 1px solid var(--jx-gold-4); border-radius: 8px;
  transform: translateY(-150%); transition: transform .2s ease;
  z-index: 9999;
}
.skip-link:focus { transform: translateY(0); }

/* Visually hidden utility */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Responsive table wrapper */
.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--jx-border); }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap table th, .table-wrap table td { padding: 10px 12px; }

/* Zebra rows */
.table-striped tbody tr:nth-child(odd) { background: #0e0e0e; }

/* Status badges */
.badge { display:inline-block; padding:4px 10px; border-radius:999px; font-size:.85rem; border:1px solid var(--jx-border); }
.badge.success { color:#0b2; border-color:#0b2; }
.badge.warning { color:#aa6a00; border-color:#aa6a00; }
.badge.error { color:#d33; border-color:#d33; }
.badge.info { color:var(--jx-gold-2); border-color:var(--jx-gold-4); }

/* Loading skeleton */
.skeleton { position: relative; overflow: hidden; background: #121212; }
.skeleton::after {
  content:""; position:absolute; inset:0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  animation: skeleton 1.2s infinite;
}
@keyframes skeleton { 0%{ transform: translateX(-100%);} 100%{ transform: translateX(100%);} }

/* Scrollbar styling (WebKit) */
*::-webkit-scrollbar { height: 10px; width: 10px; }
*::-webkit-scrollbar-track { background: #0a0a0a; }
*::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #333; }

/* Form row spacing */
.form-row { display: grid; gap: 12px; }

/* --- Google sign-in button: brighter, high-contrast --------------------- */
a.btn[href*="/auth/google"].btn {
  background: linear-gradient(180deg, #ffe06a 0%, #ffc933 90%) !important;
  border-color: #e0b400 !important;
  color: #1a1a1a !important;
  font-weight: 800;
  letter-spacing: .2px;
  opacity: 1 !important;
  box-shadow:
    0 8px 20px rgba(255, 217, 77, .28),
    inset 0 -2px 0 rgba(0,0,0,.12);
  transition: transform .08s ease, box-shadow .12s ease, background .12s ease;
  text-decoration: none !important;
}
a.btn[href*="/auth/google"].btn > span { color: #1a1a1a !important; font-weight: 800; }
a.btn[href*="/auth/google"].btn img { filter: none !important; opacity: 1 !important; }
a.btn[href*="/auth/google"].btn:hover {
  background: linear-gradient(180deg, #ffe88f 0%, #ffd24f 90%) !important;
  transform: translateY(-1px);
  box-shadow:
    0 10px 24px rgba(255, 217, 77, .38),
    inset 0 -2px 0 rgba(0,0,0,.18);
}
a.btn[href*="/auth/google"].btn:active {
  transform: translateY(0);
  background: linear-gradient(180deg, #ffd952 0%, #ffc22e 90%) !important;
  box-shadow:
    0 6px 16px rgba(255, 217, 77, .24),
    inset 0 2px 0 rgba(0,0,0,.20);
}
a.btn[href*="/auth/google"].btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(15,15,15,.9),
    0 0 0 5px #ffd84d;
}

/* =========================================================
   Defensive docs/tabs row fixes (GLOBAL-SAFE)
   ========================================================= */

/* 1) Any “tab/chip/pill/button” row should wrap instead of overlap */
.button-container,
.btn-row,
.pill-row,
.chip-row,
.tab-row,
.tabs,
.tablist,
[class*="tabbar"],
[role="tablist"],
.card .button-container,
.card [class*="tabs"],
.card [class*="tabbar"] {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 10px !important;
  row-gap: 10px !important;
}

/* 2) Make each item flow in normal layout (avoid absolute/transform stacking from other CSS) */
.tab, .tabs .tab, [role="tab"],
.pill, .chip,
.btn-row .btn, .button-container .btn {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  margin: 0 !important;
  white-space: nowrap;
}

/* 3) Prevent clipping by parents */
.card, .panel, .section, .doc-hero, .doc-nav {
  overflow: visible !important;
}

/* 4) Responsive hero heading to avoid crowding adjacent elements */
.doc-hero h1, h1.page-title {
  font-size: clamp(28px, 3.2vw, 48px);
  line-height: 1.1;
}

/* 5) CTA rows under hero should also wrap */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* 6) Nice pill visuals for any chip/tab */
.pill, .chip, .tab, [role="tab"] {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid rgba(255,216,77,.28);
  background: linear-gradient(180deg, rgba(255,216,77,.10), rgba(255,255,255,.03));
  font-weight: 700;
}

/* ===== Global Loading Overlay ===== */
/* === Refined dark translucent loader background === */
#jx-loader-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, 0.55);   /* semi-transparent deep gray */
  backdrop-filter: blur(6px) brightness(0.8);  /* soft blur with slight dimming */
  -webkit-backdrop-filter: blur(6px) brightness(0.8); /* Safari support */
  z-index: 2147483000;
}


#jx-loader-card {
  min-width: 220px;
  max-width: 70vw;
  padding: 18px 22px;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  background: rgba(0, 0, 0, 0.6);         /* darker translucent card */
  color: #f9fafb;                         /* light text */
  text-align: center;
  backdrop-filter: blur(4px);             /* keeps inner blur glow */
  -webkit-backdrop-filter: blur(4px);
}

/* ===== Global Loading Overlay ===== */
#jx-loader-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(6px) brightness(0.8);
  -webkit-backdrop-filter: blur(6px) brightness(0.8);
  z-index: 2147483000;
}

#jx-loader-card {
  min-width: 220px;
  max-width: 70vw;
  padding: 18px 22px;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  background: rgba(0, 0, 0, 0.6);
  color: #f9fafb;
  text-align: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Spinner */
.jx-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #f9fafb;
  border-radius: 50%;
  animation: jx-spin 0.85s linear infinite;
  margin: 0 auto 12px auto;
}

/* Quote text styling */
.jx-quote {
  font-size: 1rem;
  color: #f9fafb;         /* white */
  line-height: 1.4;
}

.jx-quote-subtle {
  font-size: 0.8rem;
  color: #d1d5db;         /* light gray */
  margin-top: 6px;
}

@keyframes jx-spin {
  to { transform: rotate(360deg); }
}


.jx-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: rgba(0, 0, 0, 0.65);
  border-radius: 50%;
  animation: jx-spin 0.85s linear infinite;
  margin: 0 auto 12px auto;
}

@keyframes jx-spin {
  to { transform: rotate(360deg); }
}

.jx-quote {
  font-size: 1rem;
  color: #7dd3fc;         /* sky blue (Tailwind sky-300) */
  line-height: 1.5;
  font-weight: 500;
  text-shadow: 0 0 8px rgba(125,211,252,0.35);
}

.jx-quote-subtle {
  font-size: 0.8rem;
  color: #d1d5db;
  margin-top: 6px;
}

/* Optional: fade-in for smoother feel */
.jx-fade-in { animation: jx-fade 180ms ease-out; }
@keyframes jx-fade { from {opacity: 0} to {opacity: 1} }