/* Closer Time · Wedding Editor */

:root {
  --ink: #262238;
  --muted: #858195;
  --line: #ebe8f2;
  --surface: #ffffff;
  --page: #f8f7fc;
  --purple: #7650ed;
  --purple-dark: #6339dc;
  --radius: 18px;
  --shadow: 0 12px 34px rgba(42, 27, 86, .08);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  scroll-padding-bottom: 110px;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Montserrat", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(118, 80, 237, .28);
  outline-offset: 2px;
}

.app-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 54px);
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.7px;
}

.app-header > span {
  color: var(--muted);
  font-size: 12px;
}

.editor-layout {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 30px clamp(16px, 3vw, 34px) 130px;
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  align-items: start;
  gap: clamp(24px, 4vw, 54px);
}

.preview-column {
  position: sticky;
  top: 22px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.section-heading {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--purple);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.45px;
}

.section-heading h1,
.controls-column > h2 {
  margin: 0;
  font-size: clamp(22px, 2.3vw, 29px);
  letter-spacing: -.9px;
  line-height: 1.15;
}

.live-indicator {
  flex: 0 0 auto;
  color: #4e946f;
  font-size: 11px;
  font-weight: 600;
}

/* Carte d'invitation compacte et élégante */

/* Viewer-sized preview, scaled down for the Wedding editor */
.preview-viewport {
  width: 281px;
  height: 608px;
  flex: 0 0 auto;
  position: relative;
  margin: 0 auto;
}


.preview-viewport .invitation-card.viewer-frame {
  --gradient-start: #ef91d1;
  --gradient-end: #9a7af4;

  position: absolute;
  top: 0;
  left: 50%;

  width: 390px;
  height: 844px;
  min-width: 390px;
  max-width: none;
  min-height: 844px;
  aspect-ratio: auto;
  box-sizing: border-box;

  transform: translateX(-50%) scale(.72);
  transform-origin: top center;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;

  background: linear-gradient(
    to bottom,
    var(--gradient-start) 0%,
    var(--gradient-end) 100%
  );

  color: #000;
  text-align: center;
  box-shadow: 0 12px 30px rgba(42, 27, 86, .12);
  container-type: normal;
}


/* Logo */
.preview-logo-btn {
  position: absolute;
  top: 35px;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 130px;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}

.preview-logo-btn .invitation-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Names and subtitle */
#previewTitle {
  width: 100%;
  margin: 0 0 18px;
  padding: 0 15px;
  font-family: "Great Vibes", cursive;
  font-size: 64px;
  font-weight: 400;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

#previewSubtitle {
  margin: 0;
  padding: 0 18px;
  font-family: "Playfair Display", serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* Years line */
#yearsLine {
  display: none;
  margin: 8px 0 12px;
  text-align: center;
  font-family: "Great Vibes", cursive;
  font-size: 34px;
}

#yearsText {
  display: inline-block;
}

/* Countdown */
.preview-viewport .countdown {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin: 12px 0 30px;
  font-variant-numeric: lining-nums tabular-nums;
}



.preview-viewport .time-box span {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 70px;
  font-style: italic;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: lining-nums tabular-nums;
}

.preview-viewport .time-box p {
  margin: 10px 0 0;
  font-family: "Playfair Display", serif;
  font-size: 12px;
  font-weight: 400;
  text-transform: lowercase;
}

.preview-viewport .time-box {
  width: auto;
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-viewport .separator {
  width: 8px;
  flex: 0 0 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  margin-right: 8px;
}

.preview-viewport .separator .dot {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: currentColor;
}

/* Event date and time */
#previewDate {
  margin: -12px 0 0;
  padding: 0 12px;
  font-family: "Playfair Display", serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 1.2;
}

#previewTime {
  margin: -8px 0 0;
  padding: 0 12px;
  font-family: "Playfair Display", serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.2;
}

#previewLocation {
  margin: 8px 0 0;
  font-family: "Playfair Display", serif;
  font-size: 16px;
  line-height: 1.3;
  opacity: .9;
}

/* Viewer-style bottom button mockup */
.preview-back-mock {
  position: absolute;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 90%;
  padding: 9px 22px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 24px;
  background: rgba(255, 255, 255, .25);
  backdrop-filter: blur(6px);
  color: #4d3b5d;
  font-family: "Playfair Display", serif;
  font-size: 16px;
  white-space: nowrap;
}

.preview-note {
  margin: 13px 4px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}


.controls-column { min-width: 0; }
.controls-column > h2 { margin-bottom: 8px; }

.controls-column > p:not(.eyebrow) {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.settings-card {
  margin: 0 0 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 5px 20px rgba(42, 27, 86, .035);
}

.settings-card h3 {
  margin: 0 0 17px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.2px;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: #f3f1f8;
  border-radius: 11px;
}

.segmented-control button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #777186;
  font-size: 12px;
  font-weight: 600;
}

.segmented-control button.is-selected {
  background: #fff;
  color: var(--purple-dark);
  box-shadow: 0 2px 8px rgba(37, 24, 70, .09);
}

#picker {
  display: flex;
  justify-content: center;
  margin: 0 auto 16px;
}

.color-fields {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  align-items: end;
  gap: 10px;
}

.color-fields > label {
  grid-row: 1;
  color: #777186;
  font-size: 10px;
  font-weight: 600;
}

.color-fields > label:first-of-type { grid-column: 1; }
.color-fields > label:nth-of-type(2) { grid-column: 3; }

.color-fields input[type="color"] {
  width: 100%;
  height: 40px;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

#colorTop { grid-column: 1; }
#colorBottom { grid-column: 3; }

#reverseColors {
  grid-column: 2;
  grid-row: 2;
  width: 39px;
  height: 39px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--purple);
  font-size: 19px;
}

.settings-card > label:not(.sr-only) {
  display: block;
  margin: 15px 0 7px;
  color: #5f5a70;
  font-size: 11px;
  font-weight: 600;
}

.settings-card input[type="text"],
.settings-card input[type="datetime-local"],
.settings-card select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid #e4e0ed;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.settings-card input:focus,
.settings-card select:focus {
  border-color: #a58df5;
  outline: 3px solid rgba(118, 80, 237, .1);
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.purchase-bar {
  position: fixed;
  z-index: 50;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 13px max(20px, env(safe-area-inset-left))
    calc(13px + env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-right));
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 28px rgba(42, 27, 86, .07);
  backdrop-filter: blur(16px);
}

.purchase-bar > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.purchase-bar > div span {
  color: var(--muted);
  font-size: 10px;
}

.purchase-bar > div strong { font-size: 20px; }

#btn-buy {
  min-height: 50px;
  min-width: min(330px, 60vw);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 0 23px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #8059f3, #673ee1);
  color: #fff;
  box-shadow: 0 8px 18px rgba(103, 62, 225, .23);
  font-size: 12px;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .15s ease;
}

#btn-buy:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(103, 62, 225, .29);
}

#btn-buy:active { transform: translateY(0); }

.publish-arrow { font-size: 18px; line-height: 1; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Responsivité Mobile */
@media (max-width: 860px) {
  .editor-layout {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 14px 14px 155px;
  }

  .preview-column {
    position: relative;
    top: auto;
    z-index: auto;
    width: 100%;
    padding: 12px;
    background: rgba(248,247,252,.97);
    border: 1px solid rgba(235,232,242,.9);
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(42,27,86,.08);
  }

    .preview-viewport {
    width: 281px;
    max-width: 100%;
    height: 608px;
    flex: 0 0 auto;
  }

}


/* Alignement des commandes avec wedding.html */

.preview-heading-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
}

.preview-heading-row > div {
  min-width: 0;
}

.preview-heading-row h1 {
  margin: 0;
  font-size: clamp(22px, 2.3vw, 29px);
  letter-spacing: -.9px;
  line-height: 1.15;
}

.controls-heading {
  margin-bottom: 8px;
}

.controls-heading h2 {
  margin: 0;
  font-size: clamp(22px, 2.3vw, 29px);
  letter-spacing: -.9px;
  line-height: 1.15;
}

.section-intro {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.settings-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 17px;
}

.settings-title-row h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.2px;
}

.step-number {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #f0ebff;
  color: var(--purple-dark);
  font-size: 12px;
  font-weight: 700;
}

.field {
  min-width: 0;
  margin-top: 15px;
}

.field label,
.swatch-field label {
  display: block;
  margin: 0 0 7px;
  color: #5f5a70;
  font-size: 11px;
  font-weight: 600;
}

.color-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.color-wheel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.gradient-swatches {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  width: 100%;
}

.swatch-field {
  min-width: 0;
}

.swatch-input-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.color-swatch {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.swatch-input-row input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px;
  border: 1px solid #e4e0ed;
  border-radius: 9px;
  font-size: 11px;
}

@media (max-width: 480px) {
  .settings-card {
    padding: 16px;
  }

  .gradient-swatches {
    gap: 6px;
  }

  .swatch-input-row {
    gap: 5px;
  }

  .color-swatch {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }

  .swatch-input-row input {
    padding: 7px 5px;
    font-size: 10px;
  }
}

/* Proportions de référence du Viewer - Ajustement propre du compteur */
.preview-viewport .invitation-card.viewer-frame {
  padding: 40px 10px;
}

.preview-logo-btn {
  top: 30px;
}

#previewTitle {
  margin: 75px 0 10px;
  font-size: 52px;
}

#previewSubtitle {
  font-size: 18px;
  line-height: 1.3;
  margin-bottom: 5px;
}

.preview-viewport .countdown {
  gap: 0;
  margin: 8px 0 20px;
  width: 100%;
}

.preview-viewport .time-box {
  width: 58px;
  flex: 0 0 58px;
}

.preview-viewport .time-box span {
  font-size: 40px;
}

.preview-viewport .time-box p {
  margin-top: 6px;
  font-size: 11px;
}

.preview-viewport .separator {
  width: 6px;
  flex: 0 0 6px;
  margin-left: 4px;
  margin-right: 4px;
  padding-bottom: 20px;
}

#previewDate {
  margin: 0 0 4px;
  font-size: 24px;
}

#previewTime {
  margin: 0;
  font-size: 19px;
}

/* --- PROPORTIONNALITÉ STRICTE DE L'ÉDITEUR (COPIE FIDÈLE DU VIEWER) --- */
.preview-viewport .countdown {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0px;
  margin: 12px 0 30px;
  width: 100%;
}

.preview-viewport .time-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 62px; /* Proportion exacte réduite de 100px */
  flex: 0 0 62px;
}

.preview-viewport .time-box span {
  font-family: "Cormorant Garamond", serif;
  font-size: 42px; /* Proportion exacte réduite de 70px pour coller au Viewer */
  font-style: italic;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum", "tnum";
}

.preview-viewport .time-box p {
  font-size: 11px;
  margin-top: 8px;
  text-transform: lowercase;
  font-family: Montserrat, sans-serif;
}

.preview-viewport .separator {
  width: 10px;
  flex: 0 0 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  margin-right: 8px;
  padding-bottom: 18px; /* Aligne les points exactement au milieu optique des chiffres */
}

.preview-viewport .separator .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #000;
}

/* --- CORRECTIF DÉFINITIF SECTION COULEURS --- */
.color-editor {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 15px !important;
}

.gradient-swatches {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  width: 100% !important;
  margin-top: 10px !important;
}

.swatch-field {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.swatch-field label {
  margin-bottom: 5px !important;
  color: #5f5a70 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

.swatch-input-row {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: #fff !important;
  border: 1px solid #e4e0ed !important;
  border-radius: 10px !important;
  padding: 6px 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.color-swatch {
  width: 28px !important;
  height: 28px !important;
  flex: 0 0 28px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(0, 0, 0, 0.2) !important;
  cursor: pointer !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08) !important;
}

.swatch-input-row input {
  width: 100% !important;
  min-width: 0 !important;
  border: none !important;
  background: transparent !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  outline: none !important;
  padding: 0 !important;
}

.swap-colors {
  width: 38px !important;
  height: 38px !important;
  flex: 0 0 38px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid #e4e0ed !important;
  border-radius: 10px !important;
  background: #f8f7fc !important;
  color: #7650ed !important;
  font-size: 16px !important;
  cursor: pointer !important;
  margin-top: 18px !important; /* S'aligne parfaitement avec les champs de texte en dessous du label */
  transition: background 0.2s ease !important;
}

.swap-colors:hover {
  background: #f0ebff !important;
}
