/*
 * qr.studio, direction A "Bold studio", on top of QRcdr + Bootstrap 5.2.
 * Layout: headline + form on the left, the QR on a colour-mesh stage on the right.
 * Shape rule: type chips, format switch and Download are pills; inputs/tiles 12-14px; cards 20px; stage 28px.
 * Colour: lavender-white ground, deep indigo ink (also the CTA), coral used only for emphasis.
 */

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/Bricolage-Grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --s-bg: #f7f6ff;
  --s-card: #ffffff;
  --s-tint: #efedfb;
  --s-line: #e2def4;
  --s-ink: #17123a;
  --s-muted: #5c5880;
  --s-hot: #e8481f;
  --s-cta: #17123a;
  --s-cta-ink: #ffffff;
  --s-cta-hover: #2b2466;
  --s-focus: 0 0 0 3px rgba(108, 92, 255, 0.35);
  --s-lift: 0 14px 34px -20px rgba(23, 18, 58, 0.38);
  --s-glass: rgba(255, 255, 255, 0.6);
  --s-mesh-1: #ffd6c9;
  --s-mesh-2: #d8d2ff;
  --s-mesh-3: #ffe7a6;
  --s-mesh-base: #fbeff0;
  --s-r: 14px;
  --s-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --f-body: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
  --f-display: "Bricolage Grotesque", "Geist", system-ui, "Noto Sans Arabic", sans-serif;

  --bs-body-bg: var(--s-bg);
  --bs-body-color: var(--s-ink);
  --bs-border-color: var(--s-line);
  --bs-link-color: var(--s-ink);
  --bs-link-hover-color: var(--s-cta-hover);
  --bs-font-sans-serif: var(--f-body);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --s-bg: #0f0d1f;
    --s-card: #18152d;
    --s-tint: #211d3b;
    --s-line: #2d2850;
    --s-ink: #f1effa;
    --s-muted: #aca8cb;
    --s-hot: #ff7a5c;
    --s-cta: #f1effa;
    --s-cta-ink: #17123a;
    --s-cta-hover: #d9d4f5;
    --s-focus: 0 0 0 3px rgba(167, 155, 255, 0.45);
    --s-lift: 0 16px 40px -22px rgba(0, 0, 0, 0.8);
    --s-glass: rgba(15, 13, 31, 0.55);
    --s-mesh-1: #4a2433;
    --s-mesh-2: #2c2560;
    --s-mesh-3: #4a3a17;
    --s-mesh-base: #1a1530;
  }
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body.qrcdr, body {
  background: var(--s-bg);
  color: var(--s-ink);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 { color: var(--s-ink); letter-spacing: -0.01em; }
a { color: var(--s-ink); }
:focus-visible { outline: none; box-shadow: var(--s-focus) !important; }
button, [role="tab"], label.btn, .btn { cursor: pointer; }
a, button, input, select, textarea, label, [role="tab"] { touch-action: manipulation; }
html { -webkit-tap-highlight-color: rgba(108, 92, 255, 0.15); }
.studio-pane-title { color: var(--s-ink); }

/* skip link: hidden until focused */
.studio-skip {
  position: absolute; inset-inline-start: 16px; top: 12px; z-index: 50;
  padding: 10px 16px; border-radius: 999px; background: var(--s-cta); color: var(--s-cta-ink);
  font-weight: 600; text-decoration: none; transform: translateY(-160%);
  transition: transform 0.2s var(--s-ease);
}
.studio-skip:focus { transform: none; color: var(--s-cta-ink); }
#studio-tool { scroll-margin-top: 16px; }
.form-select { background-color: var(--s-bg); color: var(--s-ink); }

/* ---------- Top bar ---------- */
.studio-bar { background: transparent; }
.studio-bar__inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; }
.studio-brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--s-ink); text-decoration: none;
  font-family: var(--f-display); font-weight: 800; font-size: 1.4rem; letter-spacing: -0.035em;
}
.studio-brand:hover { color: var(--s-ink); }
.studio-brand__mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: conic-gradient(from 210deg, #ff5a36, #ffb020, #6c5cff, #ff5a36);
  color: #ffffff; font-size: 17px;
}
.studio-brand__dot { color: var(--s-hot); }
.studio-bar__nav .navbar-nav { flex-direction: row; }
.studio-bar__nav .nav-link {
  color: var(--s-muted); padding: 8px 12px; border-radius: 999px; min-height: 44px;
  display: inline-flex; align-items: center; gap: 6px;
}
.studio-bar__nav .nav-link:hover { color: var(--s-ink); background: var(--s-tint); }
.dropdown-menu {
  --bs-dropdown-bg: var(--s-card); --bs-dropdown-color: var(--s-ink);
  --bs-dropdown-link-color: var(--s-ink); --bs-dropdown-link-hover-bg: var(--s-tint);
  --bs-dropdown-link-hover-color: var(--s-ink); --bs-dropdown-link-active-bg: var(--s-ink);
  --bs-dropdown-link-active-color: var(--s-bg); --bs-dropdown-border-color: var(--s-line);
  border-radius: var(--s-r); box-shadow: var(--s-lift); padding: 6px;
}
.dropdown-item { border-radius: 10px; }

/* ---------- Headline (top of the left column) ---------- */
.studio-intro { padding: 8px 0 22px; }
.studio-intro__title {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(2.3rem, 1.4rem + 3.2vw, 3.9rem);
  line-height: 1;
  letter-spacing: -0.045em;
  margin: 0 0 16px;
  max-width: 13ch;
  text-wrap: balance;
}
.studio-intro__title em { font-style: normal; color: var(--s-hot); }
.studio-intro__lead { color: var(--s-muted); font-size: 1.1rem; max-width: 44ch; margin: 0; }
[dir="rtl"] .studio-intro__title, :lang(zh) .studio-intro__title { letter-spacing: 0; line-height: 1.2; }

/* ---------- Type picker ---------- */
.qrcdr-form .nav-pills { gap: 8px; flex-wrap: wrap; margin: 0 0 4px; padding: 0; }
.qrcdr-form .nav-pills .nav-item { flex: 0 0 auto; }
.qrcdr-form .nav-pills .nav-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--s-line); border-radius: 999px; background: var(--s-card); color: var(--s-ink);
  font-size: 0.95rem; font-weight: 500; white-space: nowrap;
  transition: background-color 0.16s var(--s-ease), border-color 0.16s var(--s-ease), transform 0.16s var(--s-ease);
}
.qrcdr-form .nav-pills .nav-link i { color: var(--s-muted); width: 1em; text-align: center; }
.qrcdr-form .nav-pills .nav-link:hover { border-color: var(--s-ink); }
.qrcdr-form .nav-pills .nav-link:active { transform: scale(0.97); }
.qrcdr-form .nav-pills .nav-link.active,
.qrcdr-form .nav-pills .show > .nav-link {
  background: var(--s-ink) !important; border-color: var(--s-ink); color: var(--s-bg) !important;
}
.qrcdr-form .nav-pills .nav-link.active i { color: inherit; }
@media (max-width: 767.98px) {
  .qrcdr-form .nav-pills {
    flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding: 2px 2px 6px;
  }
  .qrcdr-form .nav-pills::-webkit-scrollbar { display: none; }
  .qrcdr-form .nav-pills .nav-item { scroll-snap-align: start; }
}

/* ---------- Content card ---------- */
.qrcdr-form .tab-content {
  background: var(--s-card);
  border: 1px solid var(--s-line);
  border-radius: 20px;
  box-shadow: var(--s-lift);
  padding: 20px 20px 8px;
  margin: 16px 0 20px !important;
}
.qrcdr-form .tab-content .studio-pane-title {
  font-family: var(--f-display); font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px;
}
.qrcdr-form .tab-content small { color: var(--s-muted); }
.qrcdr-form label { font-weight: 500; font-size: 0.95rem; margin-bottom: 6px; color: var(--s-ink); }

.form-control, .form-select, .input-group-text {
  border-radius: 12px !important; border-color: var(--s-line); background-color: var(--s-bg);
  color: var(--s-ink); min-height: 48px; font-size: 1rem;
}
.input-group > .form-control:not(:last-child), .input-group > .input-group-text:not(:last-child) {
  border-start-end-radius: 0 !important; border-end-end-radius: 0 !important;
}
.input-group > :not(:first-child) { border-start-start-radius: 0 !important; border-end-start-radius: 0 !important; }
.input-group-text { background: var(--s-tint); color: var(--s-muted) !important; }
.form-control::placeholder { color: var(--s-muted); opacity: 0.8; }
.form-control:focus, .form-select:focus {
  border-color: #6c5cff; background-color: var(--s-card); color: var(--s-ink); box-shadow: var(--s-focus);
}
.form-check-input:checked { background-color: var(--s-ink); border-color: var(--s-ink); }
.form-check-input:focus { box-shadow: var(--s-focus); border-color: var(--s-ink); }
.form-range::-webkit-slider-thumb { background: var(--s-ink); }
.form-range::-moz-range-thumb { background: var(--s-ink); }

/* ---------- Options as tiles; the open panel spans the row below ---------- */
#collapseSettings {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
#collapseSettings .accordion-item { display: contents !important; } /* beats Bootstrap .d-grid !important */
#collapseSettings .accordion-item > .btn {
  order: 0;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px;
  width: 100%; margin: 0 !important; padding: 14px; min-height: 92px;
  border: 1px solid var(--s-line); border-radius: var(--s-r);
  background: var(--s-card); color: var(--s-ink);
  font-size: 0.95rem; font-weight: 600; text-align: start; white-space: normal;
  transition: border-color 0.16s var(--s-ease), transform 0.16s var(--s-ease), background-color 0.16s var(--s-ease);
}
#collapseSettings .accordion-item > .btn i,
#collapseSettings .accordion-item > .btn svg { font-size: 1.3rem; color: var(--s-ink); fill: var(--s-ink); width: 1.3rem; height: 1.3rem; }
#collapseSettings .accordion-item > .btn:hover { border-color: var(--s-ink); background: var(--s-card); color: var(--s-ink); transform: translateY(-1px); }
#collapseSettings .accordion-item > .btn[aria-expanded="true"] { background: var(--s-ink); border-color: var(--s-ink); color: var(--s-bg); }
#collapseSettings .accordion-item > .btn[aria-expanded="true"] i,
#collapseSettings .accordion-item > .btn[aria-expanded="true"] svg { color: var(--s-bg); fill: var(--s-bg); }
#collapseSettings .accordion-item > .collapse,
#collapseSettings .accordion-item > .collapsing {
  order: 1;
  grid-column: 1 / -1;
  background: var(--s-card);
  border: 1px solid var(--s-line);
  border-radius: 20px;
  box-shadow: var(--s-lift);
  padding: 16px 16px 6px;
}
#collapseSettings .btn-light { background: var(--s-tint); border-color: var(--s-line); border-radius: 12px; }
#collapseSettings .btn-check:checked + .btn-light,
#collapseSettings .btn-check:checked + label {
  border-color: var(--s-ink) !important; box-shadow: 0 0 0 2px var(--s-ink) inset; background: var(--s-card);
}
@media (max-width: 575.98px) {
  #collapseSettings { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #collapseSettings .accordion-item > .btn { grid-column: span 2; min-height: 84px; }
  #collapseSettings .accordion-item:nth-child(n+4) > .btn { grid-column: span 3; }
}

/* ---------- Stage (preview column) ---------- */
.studio-stage-col { padding-top: 8px; }
.studio-preview.navbar { display: block; padding: 0; top: 16px; z-index: 5; }
.studio-preview .placeresult {
  position: relative;
  background:
    radial-gradient(60% 55% at 15% 20%, var(--s-mesh-1) 0%, transparent 60%),
    radial-gradient(55% 60% at 90% 15%, var(--s-mesh-2) 0%, transparent 60%),
    radial-gradient(70% 60% at 60% 100%, var(--s-mesh-3) 0%, transparent 60%),
    var(--s-mesh-base) !important;
  border-radius: 28px;
  padding: clamp(20px, 3vw, 36px);
  gap: 16px;
  border: 0;
}
.studio-preview .wrapresult { margin: 0; }
.studio-preview .resultholder {
  background: #ffffff; /* QR needs a light quiet zone in both themes */
  border-radius: 22px;
  padding: 16px;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  box-shadow: 0 30px 60px -28px rgba(23, 18, 58, 0.5);
  max-width: 340px;
  margin-inline: auto;
  width: 100%;
}
.studio-preview .resultholder img,
.studio-preview .resultholder > svg { width: 100%; height: auto; max-width: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .studio-preview .resultholder img,
  .studio-preview .resultholder > svg { animation: studio-in 0.4s var(--s-ease); }
}
@keyframes studio-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
.studio-preview .preloader { border-radius: 28px; }

/* vendor Save button and links: visible only if studio.js did not load */
.btn-primary, .studio-preview .generate_qrcode {
  --bs-btn-color: var(--s-cta-ink); --bs-btn-bg: var(--s-cta); --bs-btn-border-color: var(--s-cta);
  --bs-btn-hover-color: var(--s-cta-ink); --bs-btn-hover-bg: var(--s-cta-hover); --bs-btn-hover-border-color: var(--s-cta-hover);
  --bs-btn-active-color: var(--s-cta-ink); --bs-btn-active-bg: var(--s-cta-hover); --bs-btn-active-border-color: var(--s-cta-hover);
  --bs-btn-disabled-color: var(--s-cta-ink); --bs-btn-disabled-bg: var(--s-cta); --bs-btn-disabled-border-color: var(--s-cta);
}
.studio-preview .generate_qrcode { border-radius: var(--s-r) !important; min-height: 50px; font-weight: 600; }
.studio-js .studio-preview .generate_qrcode,
.studio-js .studio-preview .linksholder {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}

/* ---------- Download bar: format switch + one button ---------- */
.studio-dl { display: grid; gap: 10px; max-width: 340px; width: 100%; margin-inline: auto; }
.studio-fmt {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px;
  background: var(--s-glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-radius: 999px;
}
.studio-fmt button {
  border: 0; background: transparent; color: var(--s-ink); border-radius: 999px; min-height: 44px;
  font: 600 0.95rem var(--f-body); letter-spacing: 0.02em;
  transition: background-color 0.16s var(--s-ease);
}
.studio-fmt button[aria-checked="true"] { background: var(--s-card); box-shadow: 0 4px 12px -6px rgba(23, 18, 58, 0.35); }
.studio-dl__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; border: 0; border-radius: 999px;
  background: var(--s-cta); color: var(--s-cta-ink);
  font: 650 1.05rem var(--f-body);
  transition: transform 0.16s var(--s-ease), background-color 0.16s var(--s-ease), opacity 0.16s;
}
.studio-dl__btn:hover:not(:disabled) { background: var(--s-cta-hover); }
.studio-dl__btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.studio-dl__btn:disabled { opacity: 0.4; cursor: not-allowed; }
@media (prefers-reduced-motion: no-preference) {
  .studio-dl__btn[aria-busy="true"] i { animation: studio-bob 0.8s ease-in-out infinite; }
}
@keyframes studio-bob { 50% { transform: translateY(3px); } }

/* facts under the stage */
.studio-facts {
  list-style: none; margin: 18px 0 0; padding: 0 6px; display: grid; gap: 10px;
  color: var(--s-muted); font-size: 0.95rem;
}
.studio-facts li { display: flex; gap: 10px; align-items: baseline; }
.studio-facts i { color: var(--s-ink); width: 1.1em; text-align: center; flex: none; }

/* ---------- Mobile jump to the stage ---------- */
.studio-jump {
  position: fixed; inset-inline-start: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 20; border-radius: 999px !important;
  padding: 12px 20px; min-height: 50px; font-weight: 600;
  background: var(--s-cta) !important; color: var(--s-cta-ink) !important; border: 0 !important;
  box-shadow: 0 14px 30px -10px rgba(23, 18, 58, 0.55);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
[dir="rtl"] .studio-jump { transform: translateX(50%); }
@media (min-width: 992px) { .studio-jump { display: none; } }
@media (max-width: 991.98px) {
  .studio-preview.navbar { position: static; }
  .studio-footer { padding-bottom: 92px; }
}

/* ---------- Footer ---------- */
.studio-footer { margin-top: 56px; border-top: 1px solid var(--s-line); color: var(--s-muted); font-size: 0.95rem; }
.studio-footer__inner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding-block: 24px; }
.studio-footer .list-inline { margin: 0; }

/* ---------- Vendor surfaces in dark mode ---------- */
@media (prefers-color-scheme: dark) {
  .bg-light { background-color: var(--s-tint) !important; }
  .text-dark { color: var(--s-ink) !important; }
  .modal-content, .toast { background: var(--s-card); color: var(--s-ink); border-color: var(--s-line); }
  .btn-close { filter: invert(1); }
  .sp-replacer { background: var(--s-tint); border-color: var(--s-line); color: var(--s-ink); }
  .studio-preview .preloader { background: rgba(15, 13, 31, 0.55); color: var(--s-ink); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
