/* ============================================================
   MALTA · QUADROS — MODAL STUDIO
   Upload → Style picker → Loading → Preview → Checkout
   Mobile-first · 5 estágios · animação suave entre transições
   ============================================================ */

/* ── Override do modal base pra modo studio ─────────────── */
.modal--studio {
  padding: 0;
  align-items: stretch;
}
.modal__panel--studio {
  display: block;
  grid-template-columns: none;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100%;
  border-radius: 0;
  border: none;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

@media (min-width: 720px) {
  .modal--studio { padding: 28px; align-items: center; }
  .modal__panel--studio {
    width: 100%;
    max-width: 720px;
    height: auto;
    max-height: min(92vh, 880px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-4);
  }
}

.modal--studio .modal__close {
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--gray-4);
  backdrop-filter: blur(10px);
  z-index: 10;
}

/* ============================================================
   STAGES — visibilidade controlada via data-stage
============================================================ */
.stage {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: clamp(20px, 4vw, 32px);
  padding-top: clamp(28px, 5vw, 40px);
  gap: 18px;
  -webkit-overflow-scrolling: touch;
}
.stage.is-active {
  display: flex;
  animation: stageFadeIn 0.35s cubic-bezier(.2,.7,.2,1);
}
@keyframes stageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header de cada stage ─────────────────────────────── */
.stage__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}
.stage__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: center;
  padding: 4px 10px;
  border: 1px solid var(--gray-4);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gray-2);
  font-weight: 600;
}
.stage__step span {
  color: var(--off-white);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 12px;
}
.stage__title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(22px, 4.5vw, 30px);
  letter-spacing: -0.015em;
  line-height: 1.1;
  color: var(--off-white);
  margin: 4px 0 0;
}
.stage__title em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: var(--cream);
}
.stage__sub {
  font-size: 13.5px;
  color: var(--gray-1);
  line-height: 1.55;
  max-width: 460px;
  margin: 0 auto;
}

/* ── Footer (CTA) ─────────────────────────────────────── */
.stage__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}
.stage__cta {
  position: relative;
  font-size: 14.5px;
  padding: 16px 22px;
}
.stage__cta:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg-3);
  color: var(--gray-2);
  border: 1px solid var(--gray-4);
}
.stage__cta:disabled::after { display: none; }
.stage__cta-ready { display: none; }
.stage__cta:not(:disabled) .stage__cta-default { display: none; }
.stage__cta:not(:disabled) .stage__cta-ready { display: inline; }
.stage__fineprint {
  text-align: center;
  font-size: 11.5px;
  color: var(--gray-3);
  letter-spacing: 0.02em;
}

/* ============================================================
   UPLOAD ZONE
============================================================ */
.upload-zone {
  position: relative;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1.5px dashed var(--gray-4);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.upload-zone[data-state="loaded"] {
  border-style: solid;
  border-color: var(--gray-3);
  background: var(--bg-3);
}
.upload-zone.is-dragover {
  border-color: var(--off-white);
  background: var(--bg-3);
}

.upload-zone__pick {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  text-align: left;
  cursor: pointer;
  color: var(--off-white);
  transition: transform 0.2s ease;
}
.upload-zone__pick:hover {
  background: rgba(245, 241, 234, 0.04);
}
.upload-zone__icon {
  flex: 0 0 52px;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--bg-4);
  border: 1px solid var(--gray-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--cream);
}
.upload-zone__copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.upload-zone__title {
  font-weight: 600;
  font-size: 15.5px;
  color: var(--off-white);
}
.upload-zone__hint {
  font-size: 12px;
  color: var(--gray-2);
  letter-spacing: 0.01em;
}

/* Estado loaded — preview da foto */
.upload-zone[data-state="loaded"] .upload-zone__pick { display: none; }
.upload-zone[data-state="empty"] .upload-zone__loaded { display: none !important; }
.upload-zone__loaded {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 14px;
}
.upload-zone__thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--gray-4);
}
.upload-zone__meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.upload-zone__filename {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--off-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-zone__filesize {
  font-size: 11.5px;
  color: var(--gray-2);
}
.upload-zone__change {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--off-white);
  background: var(--bg-4);
  border: 1px solid var(--gray-4);
  transition: background 0.2s;
  flex-shrink: 0;
}
.upload-zone__change:hover { background: var(--bg-3); }

/* ============================================================
   STYLE PICKER
============================================================ */
.style-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.style-picker__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.style-picker__label {
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gray-2);
}
.style-picker__chosen {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 14px;
  color: var(--cream);
}
.style-picker__chosen.is-empty { color: var(--gray-3); }

/* Scroll container — horizontal em mobile, grid em desktop */
.style-picker__scroll {
  margin: 0 -16px;          /* full-bleed em mobile */
  padding: 0 16px 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.style-picker__scroll::-webkit-scrollbar { display: none; }
.style-picker__grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 140px;
  gap: 10px;
}

@media (min-width: 720px) {
  .style-picker__scroll {
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  .style-picker__grid {
    grid-auto-flow: row;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-columns: auto;
    gap: 8px;
  }
}

/* Card individual */
.style-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  background: var(--bg-2);
  border: 1.5px solid var(--gray-4);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  position: relative;
  transition: transform 0.25s cubic-bezier(.2,.7,.2,1), border-color 0.2s ease, background 0.2s ease;
}
.style-card:hover {
  transform: translateY(-2px);
  border-color: var(--gray-3);
}
.style-card.is-selected {
  border-color: var(--off-white);
  background: var(--bg-3);
}
.style-card__visual {
  position: relative;
  aspect-ratio: 1 / 1;
  display: block;
  overflow: hidden;
}
.style-card__body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: center;
}
.style-card__name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 15px;
  color: var(--off-white);
  letter-spacing: 0.005em;
}
.style-card__desc {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-2);
  font-weight: 600;
}

/* Estilos "Em breve" — desabilitados */
.style-card[data-disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.4);
}
.style-card[data-disabled]::before {
  content: "Em breve";
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: var(--cream);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  z-index: 5;
  border: 1px solid rgba(214, 206, 189, 0.3);
  backdrop-filter: blur(6px);
}

/* Check icon — só aparece quando selecionado */
.style-card__check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--off-white);
  color: var(--bg);
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(.34,1.56,.64,1);
}
.style-card.is-selected .style-card__check {
  opacity: 1;
  transform: scale(1);
}

/* ── Visuais únicos por estilo ──────────────────────────── */
.style-card__visual--barroco {
  background:
    radial-gradient(ellipse 80% 100% at 45% 28%, rgba(232, 188, 100, 0.55), transparent 55%),
    radial-gradient(ellipse at 50% 95%, rgba(80, 40, 18, 0.6), transparent 70%),
    linear-gradient(150deg, #3d2818 0%, #1a0f08 100%);
}
.style-card__visual--barroco::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 50% 45%, rgba(245, 220, 168, 0.4) 0%, transparent 18%);
}

.style-card__visual--vangogh {
  background:
    radial-gradient(ellipse at 30% 70%, #f4c842 0%, transparent 40%),
    radial-gradient(ellipse at 70% 30%, #2a5598 0%, transparent 45%),
    linear-gradient(135deg, #1a3a6e 0%, #d4a124 100%);
}
.style-card__visual--vangogh::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle 8px at 25% 50%, rgba(255, 245, 200, 0.4), transparent 80%),
    radial-gradient(circle 10px at 65% 35%, rgba(40, 80, 180, 0.4), transparent 80%),
    radial-gradient(circle 6px at 50% 80%, rgba(255, 220, 100, 0.5), transparent 80%);
}

.style-card__visual--renascentista {
  background:
    radial-gradient(ellipse 70% 90% at 50% 35%, rgba(240, 210, 160, 0.55), transparent 60%),
    linear-gradient(165deg, #c4a574 0%, #6e4d2a 60%, #2a1c10 100%);
}
.style-card__visual--renascentista::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 50% 40%, rgba(255, 240, 200, 0.45) 0%, transparent 25%),
    linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.25) 100%);
}

.style-card__visual--disney {
  background:
    radial-gradient(ellipse at 30% 30%, #a8d4f0 0%, transparent 50%),
    radial-gradient(ellipse at 70% 70%, #f4b8c8 0%, transparent 55%),
    linear-gradient(135deg, #6b8fc7 0%, #d68aa0 100%);
}
.style-card__visual--disney::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle 12px at 30% 35%, rgba(255, 255, 255, 0.6), transparent 70%),
    radial-gradient(circle 6px at 70% 25%, rgba(255, 240, 245, 0.7), transparent 80%),
    radial-gradient(circle 10px at 55% 70%, rgba(168, 212, 240, 0.5), transparent 70%);
}

.style-card__visual--oleo {
  background:
    radial-gradient(ellipse 100% 70% at 50% 45%, rgba(180, 145, 95, 0.45), transparent 65%),
    linear-gradient(145deg, #5a4530 0%, #2a1d12 70%, #1a1108 100%);
}
.style-card__visual--oleo::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle 4px at 20% 30%, rgba(220, 190, 140, 0.3), transparent),
    radial-gradient(circle 5px at 75% 50%, rgba(180, 140, 95, 0.4), transparent),
    radial-gradient(circle 3px at 45% 75%, rgba(240, 215, 165, 0.4), transparent),
    radial-gradient(circle 4px at 60% 25%, rgba(160, 120, 80, 0.3), transparent);
}

/* ============================================================
   STAGE LOADING — Brand loader
============================================================ */
.stage--loading {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}
.stage__loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 380px;
}

/* Símbolo Malta com halos pulsantes ─ branding loader */
.brand-loader {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-loader__halo,
.brand-loader__halo--2 {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--cream);
  opacity: 0;
  animation: brandHalo 2.2s cubic-bezier(.4,.0,.2,1) infinite;
}
.brand-loader__halo--2 {
  animation-delay: 1.1s;
}
@keyframes brandHalo {
  0%   { transform: scale(0.85); opacity: 0.65; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}
.brand-loader__symbol {
  position: relative;
  width: 64px;
  height: 64px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><defs><clipPath id='c'><circle cx='50' cy='50' r='48'/></clipPath></defs><g clip-path='url(%23c)'><circle cx='50' cy='50' r='48' fill='%23f5f1ea'/><path d='M-5 25 Q15 15 35 25 Q55 35 75 25 Q95 15 110 25 L110 32 Q90 22 70 32 Q50 42 30 32 Q10 22 -5 32 Z' fill='%230a0a0a'/><path d='M-5 50 Q15 40 35 50 Q55 60 75 50 Q95 40 110 50 L110 57 Q90 47 70 57 Q50 67 30 57 Q10 47 -5 57 Z' fill='%230a0a0a'/><path d='M-5 75 Q15 65 35 75 Q55 85 75 75 Q95 65 110 75 L110 82 Q90 72 70 82 Q50 92 30 82 Q10 72 -5 82 Z' fill='%230a0a0a'/></g></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  animation: brandPulse 2s ease-in-out infinite;
  box-shadow: 0 8px 30px rgba(214, 206, 189, 0.18);
  border-radius: 50%;
}
@keyframes brandPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* Transição suave nas mensagens rotativas */
.stage__loader-text {
  transition: opacity 0.25s ease;
}
.stage__loader-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 20px;
  color: var(--off-white);
}
.stage__loader-text {
  font-size: 13.5px;
  color: var(--gray-1);
  line-height: 1.55;
}
.stage__loader-steps {
  list-style: none;
  padding: 0;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.stage__loader-steps li {
  font-size: 13px;
  color: var(--gray-2);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 6px;
  transition: color 0.3s ease;
}
.stage__loader-steps li::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gray-4);
  flex-shrink: 0;
  transition: background 0.3s ease, transform 0.3s ease;
}
.stage__loader-steps li.is-active {
  color: var(--off-white);
}
.stage__loader-steps li.is-active::before {
  background: var(--cream);
  transform: scale(1.4);
  box-shadow: 0 0 0 4px rgba(214, 206, 189, 0.18);
}
.stage__loader-steps li.is-done {
  color: var(--gray-1);
}
.stage__loader-steps li.is-done::before {
  background: var(--cream);
}

/* ============================================================
   STAGE PREVIEW
============================================================ */
.stage__preview-img {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;
  max-height: 360px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--gray-4);
}
.stage__preview-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Em telas mais largas, preview lado a lado com escolha */
@media (min-width: 720px) {
  .stage--preview {
    display: none;
  }
  .stage--preview.is-active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 18px 24px;
    align-items: start;
  }
  .stage--preview .stage__header { grid-column: 1 / -1; }
  .stage--preview .stage__preview-img {
    grid-column: 1;
    grid-row: 2 / 4;
    max-height: none;
    aspect-ratio: 5 / 7;
  }
  .stage--preview .tier-pick {
    grid-column: 2;
    grid-row: 2;
  }
  .stage--preview .stage__footer {
    grid-column: 2;
    grid-row: 3;
  }
}

/* ============================================================
   MOBILE TUNING (≤560px)
============================================================ */
@media (max-width: 560px) {
  .stage { padding: 18px 16px 24px; gap: 16px; }
  .stage__title { font-size: 22px; }
  .stage__sub { font-size: 13px; }

  .upload-zone__pick { padding: 14px; gap: 12px; }
  .upload-zone__icon { width: 44px; height: 44px; flex-basis: 44px; }
  .upload-zone__title { font-size: 14.5px; }
  .upload-zone__hint { font-size: 11.5px; }

  .style-picker__grid {
    grid-auto-columns: 128px;
    gap: 8px;
  }
  .style-card__body { padding: 7px 8px 9px; }
  .style-card__name { font-size: 14px; }
  .style-card__desc { font-size: 9.5px; }

  .stage__cta { font-size: 13.5px; padding: 14px 18px; }
  .stage__fineprint { font-size: 11px; }

  .modal--studio .modal__close {
    width: 32px; height: 32px;
    top: 12px; right: 12px;
  }
}
