/* ===========================================================================
   HxH Store · FINAL UI POLISH (v2)
   Targeted fixes based on live review screenshots:
   - Dark search bar border on light theme
   - Sidebar/topbar hidden on auth pages (mobile needs nav always)
   - Emerald hardcoded colors overridden by selected theme
   - Auth submit button cut off / text overflow
   - Smooth nav animation
   - Better font stack (Plus Jakarta Sans / Inter fallback)
   - Captcha panel polish
   =========================================================================== */

/* Fonts */
/* Fonts are served locally by typography.css; no third-party blocking import. */

html,body{
  font-family:'Plus Jakarta Sans','Inter',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif !important;
  letter-spacing:-.01em;
}
h1,h2,h3,h4,h5,.eyebrow,.btn,strong,b,.tab,.nav-item,.top-nav a,.live-pill,.range-pill{
  font-family:'Plus Jakarta Sans','Inter',system-ui,sans-serif !important;
  letter-spacing:-.02em;
}

/* ── Always show topbar/mobile-nav on auth pages ────────────── */
html body .topbar,
html body .mobile-nav{display:flex !important;}
@media(min-width:1001px){
  html body .sidebar{display:flex !important;transform:translateX(0) !important;}
  html body .workspace{margin-left:238px !important;}
  html body .mobile-toggle{display:none !important;}
}
/* Fix auth layout so the topbar sits above, doesn't cover content */
html body .content{padding-top:24px !important;}
.auth-wrap{padding-top:20px !important;padding-bottom:140px !important;}

/* ── Search bar dark-border fix ─────────────────────────────── */
html body .header-search{
  background:var(--rx-card) !important;
  border:1.5px solid var(--rx-line) !important;
  border-radius:18px !important;
  padding:12px 18px !important;
  box-shadow:0 2px 8px rgba(0,0,0,.03),inset 0 0 0 0 transparent !important;
  transition:border-color .2s,box-shadow .2s !important;
}
html body .header-search:focus-within{
  border-color:var(--rx-accent) !important;
  box-shadow:0 0 0 4px color-mix(in srgb,var(--rx-accent) 14%,transparent) !important;
}
html body .header-search svg{color:var(--rx-ink-3) !important;}
html body .header-search kbd{
  background:var(--rx-bg-2) !important;
  border:1px solid var(--rx-line) !important;
  color:var(--rx-ink-3) !important;
  font-family:inherit !important;
}

/* ── Category chips / tabs — proper pill style ──────────────── */
html body .tab{
  background:var(--rx-bg-2) !important;
  border:1.5px solid var(--rx-line) !important;
  color:var(--rx-ink-2) !important;
  border-radius:14px !important;
  padding:9px 16px !important;
  font-weight:650 !important;
  font-size:13px !important;
  transition:.2s !important;
}
html body .tab.active{
  background:var(--rx-grad) !important;
  color:#fff !important;
  border-color:transparent !important;
  box-shadow:0 10px 22px -10px var(--rx-glow) !important;
}
html body .tabs{gap:10px !important;}

/* ── Buttons: prevent text cutoff, proper padding ───────────── */
html body .btn{
  padding:12px 22px !important;
  border-radius:16px !important;
  font-weight:780 !important;
  font-size:14px !important;
  white-space:nowrap;
  min-height:48px;
  line-height:1.2 !important;
  overflow:visible !important;
  text-overflow:clip !important;
}
html body .btn.small{
  padding:10px 16px !important;
  min-height:40px;
  font-size:13px !important;
  border-radius:12px !important;
}
html body .auth-submit,
html body .auth-submit-btn,
html body .btn[type="submit"]{
  padding:14px 22px !important;
  min-height:56px !important;
  font-size:15px !important;
  border-radius:18px !important;
  letter-spacing:-.01em !important;
  overflow:visible !important;
}
/* Ensure sign-in/sign-up submit CTA text is never clipped */
html body .auth-submit-btn{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:10px !important;
}
html body .auth-submit-btn,
html body .auth-submit-btn *{
  white-space:nowrap !important;
}
html body .btn[data-action="checkout"]{
  min-height:56px !important;
  font-size:15px !important;
}

/* ── Topbar & nav animation ─────────────────────────────────── */
html body .topbar{
  background:color-mix(in srgb,var(--rx-card) 90%,transparent) !important;
  backdrop-filter:blur(22px) saturate(1.5) !important;
  -webkit-backdrop-filter:blur(22px) saturate(1.5) !important;
  border-bottom:1px solid var(--rx-line) !important;
  padding:12px 28px !important;
  height:auto !important;
  min-height:72px;
  position:sticky !important;
  top:0;
  z-index:60;
  transition:background .25s,box-shadow .25s;
}
html body .top-brand{transition:transform .2s;}
html body .top-brand:hover{transform:scale(1.03);}
html body .top-nav a{
  position:relative;
  padding:10px 14px !important;
  border-radius:12px !important;
  transition:background .2s,color .2s,transform .2s !important;
}
html body .top-nav a::after{
  content:'';position:absolute;left:50%;bottom:4px;width:0;height:3px;border-radius:3px;
  background:var(--rx-accent);transition:width .25s,left .25s;
}
html body .top-nav a.active::after,
html body .top-nav a:hover::after{width:22px;left:calc(50% - 11px);}

/* Sidebar slide */
html body .sidebar{
  transition:transform .3s cubic-bezier(.16,1,.3,1),box-shadow .3s !important;
}
html body .nav-item{
  transition:background .22s,color .22s,transform .2s !important;
  border-radius:14px !important;
  margin:3px 0 !important;
  padding:11px 14px !important;
}
html body .nav-item.active{
  background:var(--rx-grad) !important;
  color:#fff !important;
  box-shadow:0 10px 24px -10px var(--rx-glow) !important;
}

/* Mobile toggle burger */
html body .hamburger,.mobile-toggle{
  width:44px !important;height:44px !important;border-radius:14px !important;
  display:grid;place-items:center;background:var(--rx-bg-2) !important;
  border:1.5px solid var(--rx-line) !important;color:var(--rx-ink-2) !important;
  transition:.2s !important;
}
html body .hamburger i,html body .rx-burger{display:block;position:relative;width:18px;height:2px;background:currentColor;border-radius:2px;transition:.25s}
html body .hamburger i::before,.hamburger i::after,
html body .rx-burger i{background:currentColor!important;}
html body .mobile-toggle:hover{background:var(--rx-soft) !important;color:var(--rx-accent) !important;}

/* ── Mobile nav smooth pill indicator ───────────────────────── */
html body .mobile-nav{
  background:color-mix(in srgb,var(--rx-card) 94%,transparent) !important;
  backdrop-filter:blur(24px) saturate(1.6) !important;
  -webkit-backdrop-filter:blur(24px) saturate(1.6) !important;
  border:1.5px solid var(--rx-line) !important;
  border-radius:24px !important;
  padding:8px !important;
  left:12px !important;right:12px !important;bottom:14px !important;
  box-shadow:0 24px 50px -20px rgba(0,0,0,.2) !important;
  animation:slideUp .4s cubic-bezier(.16,1,.3,1);
}
html body .mobile-nav a{
  padding:10px 8px !important;border-radius:16px !important;
  transition:.25s cubic-bezier(.16,1,.3,1) !important;
  position:relative;
}
html body .mobile-nav a.active{
  background:var(--rx-soft) !important;
  color:var(--rx-accent) !important;
  transform:translateY(-2px);
}
html body .mobile-nav svg{width:22px!important;height:22px!important;transition:transform .25s}
html body .mobile-nav a.active svg{transform:scale(1.1)}
html body .mobile-nav a .mn-label{font-weight:700 !important;font-size:11px !important;}
html body .mobile-nav-pill{display:none !important;}
@keyframes slideUp{from{transform:translateY(30px);opacity:0}to{transform:none;opacity:1}}

/* ── Captcha panel polish + prevent empty state crash ───────── */
html body .captcha-panel{
  background:var(--rx-card) !important;
  border:1.5px solid var(--rx-line) !important;
  border-radius:20px !important;
  padding:18px !important;
  margin:16px 0 !important;
}
html body .captcha-heading{color:var(--rx-ink) !important;}
html body .captcha-heading span{display:flex;align-items:center;gap:8px;font-weight:700;font-size:13px}
html body .captcha-badge-tag{
  font-size:10px !important;font-weight:750;padding:4px 10px !important;
  border-radius:999px;background:var(--rx-soft) !important;color:var(--rx-accent) !important;
  border:1px solid color-mix(in srgb,var(--rx-accent) 30%,transparent) !important;
  letter-spacing:.1em;
}
html body .captcha-picture{
  background:var(--rx-bg-2) !important;
  border:1.5px solid var(--rx-line) !important;
  border-radius:16px !important;
  padding:10px !important;
  display:grid;place-items:center;
  min-height:110px;
}
html body .captcha-picture img{border-radius:10px;max-width:100%;height:auto;}
html body .captcha-actions-bar{display:flex;gap:8px;margin-top:12px}
html body .captcha-input-group{margin-top:12px}
html body .captcha-answer-row input{
  text-align:center !important;
  letter-spacing:.6em !important;
  font-family:'Plus Jakarta Sans',ui-monospace,monospace !important;
  font-weight:780 !important;
  font-size:22px !important;
  background:var(--rx-card) !important;
  border:1.5px solid var(--rx-line) !important;
  border-radius:16px !important;
  padding:14px !important;
  min-height:56px !important;
}
html body .captcha-answer-row input:focus{
  border-color:var(--rx-accent) !important;
  box-shadow:0 0 0 4px color-mix(in srgb,var(--rx-accent) 14%,transparent) !important;
}
html body .captcha-status{color:var(--rx-ink-3) !important;font-size:12px;margin-top:10px !important;}
.captcha-action-btn{border-radius:12px !important;}
html body .install-spinner{
  width:28px;height:28px;border:3px solid var(--rx-line);border-top-color:var(--rx-accent);
  border-radius:50%;animation:spin .8s linear infinite;display:block;margin:0 auto 8px;
}
@keyframes spin{to{transform:rotate(360deg)}}

/* ── Remember-me checkbox card ──────────────────────────────── */
html body .auth-remember-field .remember-me-label{
  background:var(--rx-bg-2) !important;
  border:1.5px solid var(--rx-line) !important;
  border-radius:16px !important;
  padding:14px 16px !important;
  gap:12px !important;
}
html body .remember-me-label input[type="checkbox"]{
  width:20px !important;height:20px !important;accent-color:var(--rx-accent);
  border-radius:6px;flex-shrink:0;
}
html body .remember-me-label strong{font-size:14px !important}
html body .remember-me-label small{font-size:12px !important}

/* ── Referral field block ───────────────────────────────────── */
html body .referral-input-field{
  background:var(--rx-bg-2) !important;
  border:1.5px solid var(--rx-line) !important;
  border-radius:18px !important;
  padding:16px !important;
}
html body .ref-bonus-pill{
  background:color-mix(in srgb,var(--rx-accent) 12%,transparent) !important;
  color:var(--rx-accent) !important;
}
html body .referral-input-field input{
  background:var(--rx-card) !important;
  border:1.5px solid var(--rx-line) !important;
  border-radius:14px !important;
}

/* ── Verification note pill ─────────────────────────────────── */
html body .verification-required-note{
  background:color-mix(in srgb,var(--rx-accent) 8%,transparent) !important;
  border:1px solid color-mix(in srgb,var(--rx-accent) 22%,transparent) !important;
  border-radius:16px !important;
  padding:14px 16px !important;
}

/* ── Inputs consistent height & rounding ────────────────────── */
html body input:not([type=checkbox]):not([type=radio]),
html body select,html body textarea{
  min-height:50px !important;
  border-radius:14px !important;
  border:1.5px solid var(--rx-line) !important;
  background:var(--rx-card) !important;
  color:var(--rx-ink) !important;
  font-size:15px !important;
  padding:0 16px !important;
}
html body input:focus,html body select:focus,html body textarea:focus{
  border-color:var(--rx-accent) !important;
  box-shadow:0 0 0 4px color-mix(in srgb,var(--rx-accent) 14%,transparent) !important;
  outline:none !important;
}
html body textarea{min-height:100px !important;padding:14px 16px !important;}

/* ── Logo brand chip in header ──────────────────────────────── */
html body .top-brand .logo,
html body .brand img,
html body .top-brand img{
  transition:transform .3s cubic-bezier(.16,1,.3,1);
}
html body .top-brand .logo:hover{transform:rotate(-6deg) scale(1.06);}

/* ── Product cards & category cards smooth hover ────────────── */
html body .product,html body .category-card{
  transition:transform .28s cubic-bezier(.16,1,.3,1),border-color .28s,box-shadow .28s !important;
  border-radius:20px !important;
}
html body .product:hover,html body .category-card:hover{
  transform:translateY(-5px) !important;
}

/* ── Hero polish ────────────────────────────────────────────── */
html body .hero{
  border-radius:32px !important;
  border:1px solid color-mix(in srgb,var(--rx-accent) 20%,var(--rx-line)) !important;
  padding:44px !important;
  overflow:hidden;
}
html body .hero-notes span{
  transition:transform .25s;
}
html body .hero-notes span:hover{transform:translateY(-2px);}
html body .btn[href*="products"]{animation:pulse 2.8s ease-in-out infinite;}
@keyframes pulse{
  0%,100%{box-shadow:0 16px 32px -12px var(--rx-glow),inset 0 1px 0 rgba(255,255,255,.25)}
  50%{box-shadow:0 22px 44px -12px var(--rx-glow),inset 0 1px 0 rgba(255,255,255,.35)}
}

/* ── Scroll to top FAB ──────────────────────────────────────── */
html body .hxh-fab,.scroll-top{
  background:var(--rx-card) !important;
  border:1.5px solid var(--rx-line) !important;
  color:var(--rx-accent) !important;
  transition:.25s !important;
}
html body .hxh-fab:hover,.scroll-top:hover{
  background:var(--rx-soft) !important;
  transform:translateY(-2px);
}

/* ── Panel rounding consistency ─────────────────────────────── */
html body .panel{
  border-radius:24px !important;
  padding:26px !important;
}
html body .stat{
  border-radius:20px !important;
  transition:transform .25s,box-shadow .25s !important;
}
html body .stat:hover{transform:translateY(-3px);}

/* ── Mobile fixes (keep nav visible on auth screens) ────────── */
@media(max-width:1000px){
  html body .workspace{margin-left:0 !important;}
  html body .sidebar{position:fixed !important;top:0;left:0;bottom:0;z-index:80;transform:translateX(-105%);}
  html body .sidebar.open{transform:translateX(0);box-shadow:20px 0 60px rgba(0,0,0,.25) !important;}
  html body .mobile-toggle{display:grid !important;}
  html body .content{padding:18px 18px 120px !important;}
  html body .hero{padding:26px !important;border-radius:26px !important;}
  html body .auth-panel{margin:12px auto !important;padding:28px 22px !important;border-radius:26px !important;}
}
@media(max-width:560px){
  html body .topbar{padding:10px 14px !important;gap:8px !important;}
  html body .top-brand strong{font-size:14px !important}
  html body .top-brand small{display:none}
  html body .auth-panel{padding:24px 18px !important;}
  html body .auth-submit-btn{font-size:14px !important;min-height:52px !important;}
}

/* ── Password toggle button visible, not dark ───────────────── */
html body .password-toggle{
  background:var(--rx-bg-2) !important;
  border:1.5px solid var(--rx-line) !important;
  color:var(--rx-accent) !important;
  border-radius:12px !important;
  padding:0 14px !important;
  font-weight:700 !important;
  font-size:12px !important;
  height:38px !important;
  position:absolute;right:8px;top:50%;transform:translateY(-50%);
}
html body .password-wrap{position:relative;}
html body .password-wrap input{padding-right:92px !important;}

/* ── Smoothly load images ───────────────────────────────────── */
img{transition:opacity .3s ease;}
img[data-lazy]:not([src]){opacity:0;}

/* Remove the green scroll-progress default when on violet accent */
html[data-theme="violet"] body::after,
html body .topbar ~ .progress,
html body .page-progress{background:var(--rx-accent) !important;}

/* Fix z-index so dropdowns appear over panels */
html body .search-suggest{
  background:var(--rx-card) !important;
  border:1.5px solid var(--rx-line) !important;
  border-radius:16px !important;
  box-shadow:0 24px 48px -24px rgba(0,0,0,.2) !important;
  z-index:200 !important;
}

/* ===== EMERALD BLEED FIX — force theme accent on auth titles & buttons ===== */
.auth-panel h2, .auth-header-block h2,
.auth-pill-badge { color: var(--rx-accent) !important; }

.auth-submit-btn, .register-submit-btn,
button.auth-submit-btn, .otp-form .auth-submit-btn,
#login-otp-start-form .auth-submit-btn {
  background: linear-gradient(135deg, var(--rx-accent), var(--rx-accent-2, var(--rx-accent))) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 10px 30px -10px var(--rx-accent), 0 0 0 0 transparent !important;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease !important;
}
.auth-submit-btn:hover, .register-submit-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 16px 36px -12px var(--rx-accent) !important;
}
.auth-submit-btn:active { transform: translateY(0); }
.auth-submit-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--rx-accent) 40%, transparent);
  outline-offset: 3px;
}

/* tab pill active accent */
.auth-method-tabs button.active,
.reset-step-strip .is-active {
  background: color-mix(in srgb, var(--rx-accent) 16%, transparent) !important;
  color: var(--rx-accent) !important;
  border-color: color-mix(in srgb, var(--rx-accent) 40%, transparent) !important;
}

/* ===== MOBILE NAV: don't mark anything active on auth / static pages ===== */
body[data-page="login"] .mobile-nav a.active,
body[data-page="register"] .mobile-nav a.active,
body[data-page="forgot-password"] .mobile-nav a.active,
body[data-page="reset-password"] .mobile-nav a.active,
body[data-page="verify-email"] .mobile-nav a.active,
body[data-page="setup"] .mobile-nav a.active,
body[data-page="terms"] .mobile-nav a.active,
body[data-page="privacy"] .mobile-nav a.active,
body[data-page="refunds"] .mobile-nav a.active,
body[data-page="cookies"] .mobile-nav a.active,
body[data-page="about"] .mobile-nav a.active,
body[data-page="contact"] .mobile-nav a.active,
body[data-page="support"] .mobile-nav a.active,
body[data-page="app"] .mobile-nav a.active,
body[data-page="not-found"] .mobile-nav a.active {
  color: var(--rx-muted) !important;
  background: transparent !important;
  font-weight: 500 !important;
}
body[data-page="login"] .mobile-nav-pill span,
body[data-page="register"] .mobile-nav-pill span,
body[data-page="forgot-password"] .mobile-nav-pill span,
body[data-page="reset-password"] .mobile-nav-pill span,
body[data-page="verify-email"] .mobile-nav-pill span,
body[data-page="setup"] .mobile-nav-pill span {
  opacity: 0 !important;
  transform: scale(.8) !important;
}

/* ===== SEARCH — completely kill dark border on light theme ===== */
.light .header-search,
:root:not([data-theme="dark"]) .header-search {
  border: 1px solid var(--rx-border) !important;
  box-shadow: 0 1px 2px rgba(15,23,42,.04) !important;
  background: var(--rx-surface-2) !important;
}
.light .header-search:focus-within,
:root:not([data-theme="dark"]) .header-search:focus-within {
  border-color: color-mix(in srgb, var(--rx-accent) 55%, var(--rx-border)) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--rx-accent) 18%, transparent) !important;
  background: var(--rx-surface) !important;
}

/* ===== "All products" pill — remove strong emerald glow, use theme accent ===== */
.tab.active, .tab[aria-selected="true"],
.chip.active, .chip[aria-pressed="true"],
.category-pill.active {
  background: linear-gradient(135deg, var(--rx-accent), var(--rx-accent-2, var(--rx-accent))) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 8px 20px -10px var(--rx-accent) !important;
}

/* ===== REMEMBER-ME card — proper surface instead of beige ===== */
.remember-me-label, .auth-remember-field .remember-me-label {
  background: var(--rx-surface-2) !important;
  border: 1px solid var(--rx-border) !important;
  border-radius: 14px !important;
  padding: 12px 14px !important;
  display: flex !important;
  gap: 12px !important;
  align-items: flex-start !important;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.remember-me-label:hover { border-color: color-mix(in srgb, var(--rx-accent) 30%, var(--rx-border)) !important; }
.remember-me-label:has(input:checked) {
  border-color: color-mix(in srgb, var(--rx-accent) 50%, var(--rx-border)) !important;
  background: color-mix(in srgb, var(--rx-accent) 6%, var(--rx-surface-2)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent) 12%, transparent);
}
.remember-me-label input[type="checkbox"] {
  accent-color: var(--rx-accent);
  width: 18px; height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
}
.remember-me-label span strong { color: var(--rx-text); display: block; font-weight: 600; font-size: 14px; }
.remember-me-label span small { color: var(--rx-muted); font-size: 12px; line-height: 1.45; }

/* ===== CAPTCHA panel — ensure placeholder visible ===== */
.captcha-art, .captcha-image, [data-captcha-image], .captcha-box img {
  background: var(--rx-surface-2);
  border: 1px dashed var(--rx-border);
  border-radius: 12px;
  min-height: 80px;
  display: block;
}
.captcha-box, .captcha-panel, .captcha-card {
  background: var(--rx-surface-2) !important;
  border: 1px solid var(--rx-border) !important;
  border-radius: 16px !important;
  padding: 14px !important;
}
.captcha-status, [data-captcha-status], .captcha-error {
  color: var(--rx-muted) !important;
  font-size: 12px !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}

/* ===== REFERRAL field on signup ===== */
.auth-panel .field:has([name="ref"]),
.auth-panel [name="ref"] {
  display: block !important;
  visibility: visible !important;
}

/* ===== Auth header gradient text — ensure it uses theme grad ===== */
html body .auth-panel h2, html body .auth-header-block h2 {
  background: var(--rx-grad) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
}
html body .auth-panel h3, html body .auth-pill-badge {
  color: var(--rx-accent) !important;
}

/* ===== Fix "Create Free Account" button not being clipped — container overflow visible ===== */
html body .auth-panel, html body .register-art-panel { overflow: visible !important; padding-bottom: 32px !important; }
html body .auth-panel form { overflow: visible !important; padding-bottom: 8px !important; }

/* ===== Referral field spacing ===== */
html body .auth-panel .field:has([name="ref"]) { margin-top: 6px; }
html body .auth-panel [name="ref"] { letter-spacing: .04em; font-family: 'JetBrains Mono', 'Plus Jakarta Sans', monospace; }

/* ===== Submit button spinner alignment fix (when in loading state) ===== */
html body .auth-submit-btn .install-spinner { margin-right: 8px; }

/* ===== Desktop auth panel nicer width ===== */
@media(min-width:801px){
  html body .auth-panel { max-width: 480px !important; margin: 24px auto !important; padding: 38px 40px 40px !important; border-radius: 28px !important; }
}
