/* ==========================================
   STUDIO.CSS — Trang tạo thiệp cá nhân
   Theme: Blush / Cream / Rose Gold
   ========================================== */

@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;1,400&family=DM+Sans:wght@300;400;500;600;700&family=Great+Vibes&display=swap");

/* ===== TOKENS ===== */
:root {
  --rose:        #b5405b;
  --rose-dark:   #8c2d45;
  --rose-light:  #e8a5b8;
  --blush:       #f5d6de;
  --blush-2:     #fde8ee;
  --petal:       #fff0f5;
  --gold:        #c9954a;
  --gold-light:  #e8c97a;
  --sage:        #7a9e7e;
  --cream:       #fdf8f2;
  --cream-2:     #f9f0e6;
  --ink:         #2a1219;
  --ink-2:       #4a2c35;
  --muted:       #8a6a72;
  --white:       #ffffff;
  --border:      rgba(181,64,91,0.18);
  --shadow-sm:   0 2px 12px rgba(42,18,25,0.07);
  --shadow-md:   0 8px 32px rgba(42,18,25,0.12);
  --shadow-lg:   0 20px 64px rgba(42,18,25,0.16);
  --serif:       "Playfair Display", Georgia, serif;
  --script:      "Great Vibes", cursive;
  --sans:        "DM Sans", "Segoe UI", Arial, sans-serif;
  --r-sm:        8px;
  --r-md:        14px;
  --r-lg:        24px;
  --r-xl:        32px;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }

body.studio-page {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img  { display: block; max-width: 100%; }
a    { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; background: none; }
p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; }

/* ===== TOP BAR ===== */
.studio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 40px;
  background: rgba(253,248,242,0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.studio-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.studio-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), #e8608a);
  color: var(--white);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  font-weight: 400;
  box-shadow: 0 4px 14px rgba(181,64,91,0.28);
  flex-shrink: 0;
}

.studio-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.studio-brand-text strong {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.studio-brand-text small {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.studio-preview-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--rose-dark);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.studio-preview-link:hover {
  background: var(--petal);
  border-color: var(--rose-light);
  transform: translateY(-1px);
}

/* ===== MAIN ===== */
.studio-main {
  flex: 1;
  width: min(1200px, calc(100% - 48px));
  margin-inline: auto;
  padding-block: 56px 80px;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

/* ===== INTRO ===== */
.studio-intro {
  text-align: center;
  max-width: 680px;
  margin-inline: auto;
}

.studio-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--rose);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}
.studio-eyebrow::before,
.studio-eyebrow::after {
  content: "";
  display: block;
  width: 24px;
  height: 1px;
  background: var(--rose-light);
}

.studio-intro h1 {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  color: var(--ink);
  margin-bottom: 16px;
}
.studio-intro h1 em {
  font-style: italic;
  color: var(--rose-dark);
}

.studio-intro-desc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.75;
  max-width: 560px;
  margin-inline: auto;
}

/* ===== LAYOUT ===== */
.studio-layout {
  display: grid;
  grid-template-columns: minmax(0,1.05fr) minmax(340px,0.95fr);
  gap: 32px;
  align-items: start;
}

/* ===== FORM PANEL ===== */
.studio-form-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.studio-step {
  background: var(--white);
  border: 1px solid rgba(232,165,184,0.28);
  border-radius: var(--r-xl);
  padding: 36px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

/* Top accent line */
.studio-step::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rose), #e8608a, var(--gold));
}

.step-label {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 28px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--petal);
  border: 1.5px solid var(--rose-light);
  color: var(--rose-dark);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  margin-top: 3px;
}

.step-label h2 {
  font-family: var(--sans);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
}
.step-label p {
  color: var(--muted);
  font-size: 0.82rem;
}

/* Form fields */
.studio-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.field-required {
  color: var(--rose);
}

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.char-count {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.field-input,
.select-wrap select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid rgba(42,18,25,0.12);
  border-radius: var(--r-md);
  background: var(--cream);
  color: var(--ink);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  appearance: none;
}

.field-input:focus,
.select-wrap select:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(181,64,91,0.10);
  background: var(--white);
}

.field-input::placeholder { color: #b0909a; }

textarea.field-input { resize: vertical; }

/* Custom select */
.select-wrap {
  position: relative;
}
.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
}


/* Form actions */
.form-actions {
  display: flex;
  gap: 12px;
  padding-top: 4px;
}

.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--rose), #e8608a);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 22px rgba(181,64,91,0.32);
  transition: transform 0.2s ease, box-shadow 0.25s ease;
  cursor: pointer;
}
.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(181,64,91,0.42);
}
.btn-generate:active { transform: translateY(0); }

.btn-reset {
  padding: 14px 22px;
  border-radius: 100px;
  border: 1.5px solid rgba(42,18,25,0.15);
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  transition: all 0.2s ease;
}
.btn-reset:hover {
  background: var(--cream-2);
  border-color: rgba(42,18,25,0.25);
  color: var(--ink);
}

/* ===== RESULT STEP ===== */
.studio-step--result {
  border-color: rgba(232,165,184,0.2);
  opacity: 0.5;
  transition: opacity 0.35s ease, box-shadow 0.35s ease;
}

.studio-step--result.is-ready {
  opacity: 1;
  box-shadow: var(--shadow-lg);
  border-color: rgba(181,64,91,0.25);
}

.result-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-link-row {
  position: relative;
}

.result-link-row input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid rgba(42,18,25,0.12);
  border-radius: var(--r-md);
  background: var(--cream);
  color: var(--ink);
  font-size: 0.82rem;
  outline: none;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.result-link-row input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(181,64,91,0.10);
}

.result-link-row input::placeholder { color: #c0a5ad; font-family: var(--sans); }

.result-btns {
  display: flex;
  gap: 10px;
}

.result-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1;
  padding: 11px 18px;
  border-radius: var(--r-md);
  font-size: 0.84rem;
  font-weight: 700;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 0;
  text-decoration: none;
}

.result-btn--copy {
  background: var(--cream-2);
  color: var(--ink);
  border: 1.5px solid rgba(42,18,25,0.12);
}
.result-btn--copy:hover:not(:disabled) {
  background: var(--blush);
  border-color: var(--rose-light);
  color: var(--rose-dark);
}
.result-btn--copy:disabled { opacity: 0.45; cursor: not-allowed; }

.result-btn--open {
  background: linear-gradient(135deg, var(--rose), #e8608a);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(181,64,91,0.28);
}
.result-btn--open:hover:not([aria-disabled="true"]) {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(181,64,91,0.38);
}
.result-btn--open[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  box-shadow: none;
}

.builder-status {
  min-height: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--rose-dark);
  background: var(--petal);
  border-radius: var(--r-sm);
  padding: 0;
  transition: all 0.2s ease;
}
.builder-status:not(:empty) { padding: 10px 14px; }

/* ===== PREVIEW PANEL ===== */
.studio-preview-panel {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}
.preview-header span:first-child {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.preview-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(122,158,126,0.15);
  color: var(--sage);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.preview-live-badge::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--sage);
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Preview card */
.preview-card {
  background: linear-gradient(150deg, #fdf8f2 0%, #fde8ee 60%, #f5d6de 100%);
  border: 1px solid rgba(232,165,184,0.35);
  border-radius: var(--r-xl);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.preview-petal {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.preview-petal--tl {
  width: 200px; height: 200px;
  top: -70px; left: -70px;
  background: radial-gradient(circle, rgba(232,165,184,0.35), transparent 70%);
}
.preview-petal--br {
  width: 180px; height: 180px;
  bottom: -50px; right: -50px;
  background: radial-gradient(circle, rgba(201,149,74,0.15), transparent 70%);
}

.preview-card-body {
  padding: 36px 32px 28px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preview-eyebrow {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.preview-recipient {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--rose-dark);
  line-height: 1.2;
  overflow-wrap: anywhere;
  min-height: 1.8rem;
  transition: color 0.3s ease;
}

.preview-names {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--script);
  font-size: 2.4rem;
  color: var(--rose);
  line-height: 1;
}
.preview-names em {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--gold);
}

/* Flourish divider */
.preview-divider {
  display: flex;
  align-items: center;
  gap: 8px;
}
.preview-divider span:not(.preview-diamond) {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,149,74,0.45), transparent);
}
.preview-diamond {
  width: 5px; height: 5px;
  background: var(--gold);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.preview-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--rose-dark);
  line-height: 1.65;
  padding: 12px 16px;
  background: rgba(255,255,255,0.55);
  border-left: 2.5px solid var(--rose-light);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  transition: color 0.3s ease;
  overflow-wrap: anywhere;
  min-height: 3.5rem;
}

.preview-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.preview-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.preview-meta-icon { font-size: 0.95rem; flex-shrink: 0; }
.preview-meta-row span:last-child {
  font-size: 0.82rem;
  color: var(--ink-2);
  font-weight: 500;
}

.preview-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 32px;
  background: rgba(255,255,255,0.50);
  border-top: 1px solid rgba(232,165,184,0.25);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}
.preview-card-footer span:first-child {
  font-family: var(--serif);
  font-style: italic;
  color: var(--rose-dark);
  font-size: 0.88rem;
}

.preview-footnote {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* ===== HOW IT WORKS ===== */
.studio-how {
  text-align: center;
  padding-top: 16px;
}

.studio-how .studio-eyebrow { margin-bottom: 28px; }

.how-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 20px;
  margin-top: 0;
}

.how-item {
  padding: 32px 24px;
  background: var(--white);
  border: 1px solid rgba(232,165,184,0.22);
  border-radius: var(--r-lg);
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.how-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.how-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  background: var(--petal);
  border-radius: 50%;
  margin-inline: auto;
}

.how-item h3 {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}

.how-item p {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ===== FOOTER ===== */
.studio-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 40px;
  border-top: 1px solid rgba(232,165,184,0.2);
  background: var(--white);
}

.footer-brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--rose-dark);
}

.studio-footer span:last-child {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 920px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }

  .studio-preview-panel {
    position: static;
    order: -1;
  }

  .preview-card-body { padding: 28px 24px 22px; }

  .how-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .studio-topbar { padding: 12px 20px; }
  .studio-main { padding-block: 36px 56px; width: calc(100% - 32px); }
  .studio-step { padding: 26px 20px; }

  .form-row { grid-template-columns: 1fr; gap: 14px; }

  .result-btns { flex-direction: column; }
  .result-btn { width: 100%; }

  .how-grid { grid-template-columns: 1fr; }

  .studio-footer { padding: 20px; flex-direction: column; text-align: center; }

  .preview-names { font-size: 1.9rem; }
  .preview-recipient { font-size: 1.25rem; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .preview-live-badge::before { animation: none; }
  .how-item, .btn-generate { transition: none; }
}
