/* styles/wheel-files/wheel-save-download.css
   SpinChoice — Save Wheel Modal (feature-specific)
   ✅ Tabs: Download / My Wheels
   ✅ Download tab: filename input w/ .wheel suffix
   ✅ My Wheels tab: mini wheel preview + metadata
   ✅ Full opacity panel, centered, no blur
   ✅ Premium thinner typography + sharper corners
*/

:root{
  --swm-panel: #0b0f14;         /* premium neutral-black */
  --swm-border: rgba(148,163,184,0.14);
  --swm-text: #e2e8f0;
  --swm-title: #f8fafc;
  --swm-muted: rgba(226,232,240,0.66);

  --swm-input-bg: rgba(15,23,42,0.78);
  --swm-input-bg-2: rgba(15,23,42,0.88);

  --swm-focus: rgba(129,140,248,0.70);
  --swm-focus-ring: rgba(129,140,248,0.16);

  --swm-primary-bg: rgba(46,177,99,0.16);
  --swm-primary-border: rgba(46,177,99,0.30);

  --swm-danger: #ef4444;

  --swm-radius-panel: 10px;
  --swm-radius-field: 8px;
  --swm-radius-btn: 8px;

  --swm-fw-title: 650;
  --swm-fw-tab: 600;
  --swm-fw-suffix: 650;
  --swm-fw-btn: 650;
}

html[data-theme="light"]{
  --swm-panel: #ffffff;
  --swm-border: rgba(15,23,42,0.12);
  --swm-text: #0f172a;
  --swm-title: #0b1220;
  --swm-muted: rgba(15,23,42,0.60);

  --swm-input-bg: rgba(15,23,42,0.06);
  --swm-input-bg-2: rgba(15,23,42,0.10);

  --swm-focus: rgba(37,99,235,0.55);
  --swm-focus-ring: rgba(37,99,235,0.12);

  --swm-primary-bg: rgba(46,177,99,0.10);
  --swm-primary-border: rgba(46,177,99,0.20);
}

/* Shell */
.swm{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}
.swm.is-open{ display:block; }

/* Backdrop (NO blur) */
.swm__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}

/* Panel (center) */
.swm__panel{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  width: min(620px, calc(100vw - 28px));
  background: var(--swm-panel);
  border: 1px solid var(--swm-border);
  border-radius: var(--swm-radius-panel);
  box-shadow: 0 30px 85px rgba(0,0,0,0.65);

  padding: 14px 14px 12px;
  color: var(--swm-text);
  font-family: inherit;
}

.swm__title{
  font-weight: var(--swm-fw-title);
  color: var(--swm-title);
  letter-spacing: .01em;
  font-size: 1rem;
  margin: 0 0 6px 0;
}

.swm__msg{
  margin: 0 0 12px 0;
  color: var(--swm-muted);
  font-size: .90rem;
  line-height: 1.35;
  white-space: pre-wrap;
  font-weight: 420;
}

/* Tabs */
.swm__tabs{
  display: flex;
  gap: 18px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--swm-border);
  margin-bottom: 12px;
  position: relative;
}

.swm__tab{
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--swm-muted);
  font: inherit;
  font-weight: var(--swm-fw-tab);
  font-size: .88rem;
  letter-spacing: .01em;
  padding: 6px 0;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.swm__tab:hover{ opacity: .95; }
.swm__tab.is-active{ color: var(--swm-title); }

.swm__tab-ico{
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  opacity: 0.92;
}

.swm__underline{
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 40px;
  border-radius: 999px;
  background: var(--swm-focus);
  transform: translateX(0);
  transition: transform .26s ease, width .26s ease;
  opacity: .95;
}

/* Sections (we toggle them) */
.swm__section{ display: none; }
.swm__section.is-show{ display: block; }

/* --- Download section (filename) --- */
.swm__label{
  display: inline-block;
  color: var(--swm-muted);
  font-size: .84rem;
  margin: 0 0 6px 0;
  font-weight: 520;
}

.swm__field{
  display: flex;
  align-items: stretch;
  width: 100%;
}

.swm__input{
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--swm-radius-field) 0 0 var(--swm-radius-field);
  border: 1px solid var(--swm-border);
  border-right: 0;
  background: var(--swm-input-bg);
  color: var(--swm-title);
  outline: none;
  font: inherit;
  font-weight: 430;
}

.swm__suffix{
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 12px;
  border-radius: 0 var(--swm-radius-field) var(--swm-radius-field) 0;
  border: 1px solid var(--swm-border);
  background: var(--swm-input-bg-2);
  color: var(--swm-title);
  font-weight: var(--swm-fw-suffix);
  letter-spacing: .01em;
  user-select: none;
}

.swm__input:focus{
  border-color: var(--swm-focus);
  box-shadow: 0 0 0 2px var(--swm-focus-ring);
}

.swm__hint{
  margin-top: 8px;
  color: var(--swm-muted);
  font-size: .84rem;
  font-weight: 420;
}
.swm__hint b{ color: var(--swm-title); font-weight: 650; }

/* --- My Wheels section (preview) --- */
.swm__preview{
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.swm__thumb{
  width: 140px;
  height: 140px;
  border-radius: 12px; /* slightly rounded but sharper than before */
  border: 1px solid var(--swm-border);
  background: rgba(255,255,255,0.03);
  display: grid;
  place-items: center;
  overflow: hidden;
}

html[data-theme="light"] .swm__thumb{
  background: rgba(15,23,42,0.03);
}

.swm__thumb canvas{
  width: 140px;
  height: 140px;
  display: block;
}

.swm__meta{
  flex: 1 1 auto;
  min-width: 0;
}

.swm__metatitle{
  font-weight: 650;
  color: var(--swm-title);
  font-size: .95rem;
  letter-spacing: .01em;
  margin: 2px 0 8px 0;
}

.swm__metagrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

@media (max-width: 520px){
  .swm__preview{ flex-direction: column; }
  .swm__thumb{ width: 160px; height: 160px; }
  .swm__thumb canvas{ width: 160px; height: 160px; }
  .swm__metagrid{ grid-template-columns: 1fr; }
}

.swm__metaitem{
  border: 1px solid var(--swm-border);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.02);
}

html[data-theme="light"] .swm__metaitem{
  background: rgba(15,23,42,0.03);
}

.swm__meta-k{
  color: var(--swm-muted);
  font-size: .78rem;
  margin-bottom: 2px;
  font-weight: 520;
}

.swm__meta-v{
  color: var(--swm-title);
  font-size: .86rem;
  font-weight: 480;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Error */
.swm__error{
  display: none;
  margin-top: 8px;
  color: var(--swm-danger);
  font-weight: 650;
  font-size: .82rem;
}
.swm__error.is-show{ display:block; }

/* Actions */
.swm__actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.swm__btn{
  height: 38px;
  padding: 0 12px;
  border-radius: var(--swm-radius-btn);
  border: 1px solid var(--swm-border);
  background: rgba(15,23,42,.16);
  color: var(--swm-title);
  font-weight: var(--swm-fw-btn);
  cursor: pointer;
  font: inherit;
}

html[data-theme="light"] .swm__btn{ background: rgba(15,23,42,.06); }

.swm__btn--ghost{ background: transparent; }
.swm__btn--primary{
  background: var(--swm-primary-bg);
  border-color: var(--swm-primary-border);
}

.swm__btn:focus{ outline: none; }
.swm__btn:focus-visible{
  outline: 2px solid var(--swm-focus);
  outline-offset: 2px;
}
