@font-face {
  font-family: "Brown";
  font-style: normal;
  font-weight: 100 400;
  font-display: swap;
  src: url("/static/fonts/brown-light.woff2") format("woff2");
}

@font-face {
  font-family: "Brown";
  font-style: normal;
  font-weight: 401 600;
  font-display: swap;
  src: url("/static/fonts/brown-medium.woff2") format("woff2");
}

@font-face {
  font-family: "Brown";
  font-style: normal;
  font-weight: 601 900;
  font-display: swap;
  src: url("/static/fonts/brown-bold.woff2") format("woff2");
}

@font-face {
  font-family: "Domaine Sans Text";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/domaine-sans-text-medium.woff2") format("woff2");
}

:root {
  --color-primary: #fbf9f3;
  --color-primary-dark: #ede9dd;
  --color-tertiary: #000;
  --color-tertiary-light: #5e5e5e;
  --color-tertiary-lightest: #e5e5e5;
  --color-danger: rgb(139, 31, 27);
  --font-heading: "Domaine Sans Text", "Inter", sans-serif;
  --font-body: "Brown", -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

[x-cloak] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--color-primary);
  color: var(--color-tertiary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.page-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-bottom: 30px;
}

.page-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 28px;
  margin: 0;
}

.burger-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 28px;
  height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: gap 0.15s ease;
}

.burger-btn:hover {
  gap: 3px;
}

.burger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-tertiary);
}

.header-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.heytens-language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--color-tertiary-lightest);
  border-radius: 8px;
  background: var(--color-primary);
  flex-shrink: 0;
}

.heytens-language-switcher-button {
  min-width: 34px;
  min-height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: transparent;
  color: var(--color-tertiary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.heytens-language-switcher-button:hover {
  background: var(--color-primary-dark);
}

.heytens-language-switcher-button[data-active="true"] {
  background: var(--color-tertiary);
  color: var(--color-primary);
}

.user-menu-wrap {
  position: relative;
}

.user-avatar-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--color-tertiary);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  min-width: 160px;
  border: 1px solid var(--color-tertiary-lightest);
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.user-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 15px;
  border: none;
  background: none;
  color: var(--color-tertiary);
  font-size: 14px;
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
}

.user-menu-item:hover {
  background: var(--color-primary-dark);
}

.layout {
  --layout-gap: 40px;
  display: grid;
  grid-template-columns: 460px 1fr 200px;
  gap: var(--layout-gap);
  align-items: start;
}

.layout.sidebar-collapsed {
  grid-template-columns: 0 1fr 200px;
}

/* Le formulaire (colonne 1) est réduit à 0, mais `gap` s'applique quand même
   entre chaque paire de colonnes adjacentes : sans ce correctif, le rendu
   hérite d'une marge gauche fantôme égale au gap (espace pour une colonne
   masquée) tout en gardant un vrai gap avec l'historique — le supprimer
   entièrement (`gap: 0`) réglait la marge fantôme mais collait aussi le
   rendu contre l'historique à droite. */
.layout.sidebar-collapsed .panel-render {
  margin-left: calc(-1 * var(--layout-gap));
}

.panel-form {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-tertiary-light);
  margin: 0;
}

.required-dot {
  color: var(--color-danger);
}

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  border: 1px dashed var(--color-tertiary-light);
  background-color: var(--color-primary-dark);
  padding: 20px;
  text-align: center;
}

.dropzone.has-photo {
  border-style: solid;
  border-color: var(--color-tertiary-lightest);
  background: none;
  padding: 0;
}

.dropzone-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-text {
  color: var(--color-tertiary-light);
  font-size: 14px;
  max-width: 260px;
}

.photo-preview-wrap {
  position: relative;
  z-index: 2;
  display: inline-block;
  max-width: 100%;
}

.photo-preview {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  object-fit: contain;
  border: 1px solid var(--color-tertiary-lightest);
}

.photo-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.combobox {
  position: relative;
}

.combobox input {
  width: 100%;
  padding: 10px 15px;
  min-height: 44px;
  border: 1px solid var(--color-tertiary);
  font-size: 15px;
  font-family: var(--font-body);
}

.combobox input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-tertiary);
}

.combobox input[readonly] {
  cursor: pointer;
  background: #fff;
}

.combobox-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.combobox-row .combobox {
  flex: 1;
  min-width: 0;
}

.btn-clear-square {
  flex-shrink: 0;
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--color-tertiary-lightest);
  background: #fff;
  color: var(--color-tertiary);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-clear-square:hover {
  background: var(--color-tertiary);
  border-color: var(--color-tertiary);
  color: #fff;
}

.selection-caption {
  margin: 0;
  font-size: 14px;
  color: var(--color-tertiary-light);
}

.liste-produits {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--color-tertiary-lightest);
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.liste-produits li {
  padding: 10px 15px;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.liste-produits li:hover,
.liste-produits li.selected {
  background: var(--color-primary-dark);
}

.panel-render {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.panel-history {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.history-empty {
  font-size: 13px;
  color: var(--color-tertiary-light);
  margin: 0;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  width: 100%;
  border: 1px solid var(--color-tertiary-lightest);
  background: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.history-thumb {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

.history-caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--color-tertiary-light);
}

.history-date {
  font-size: 11px;
  color: var(--color-tertiary-light);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .panel-form,
  .panel-render,
  .panel-history {
    grid-column: auto;
  }

  /* En layout mono-colonne, les panneaux s'empilent via le flux normal de la
     grille (pas de colonne masquée à compenser) — annule le correctif
     desktop de `.layout.sidebar-collapsed .panel-render`. */
  .layout.sidebar-collapsed .panel-render {
    margin-left: 0;
  }
}

.render-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.render-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-tertiary-light);
  margin: 0;
}

.view-mode-toggle {
  display: flex;
  gap: 6px;
}

.view-mode-toggle button {
  border: 1px solid var(--color-tertiary);
  background: #fff;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.view-mode-toggle button.selected {
  background: var(--color-tertiary);
  color: #fff;
}

.render-area {
  min-height: 480px;
  border: 1px solid var(--color-tertiary-lightest);
  background-color: var(--color-primary);
  background-image: repeating-linear-gradient(
    135deg,
    var(--color-primary-dark) 0px,
    var(--color-primary-dark) 2px,
    transparent 2px,
    transparent 16px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.render-area.has-result {
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
}

.render-placeholder-text {
  max-width: 320px;
  color: var(--color-tertiary-light);
  font-size: 14px;
  margin: 0 auto;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chips button,
.chips span {
  border: 1px solid var(--color-tertiary);
  background: #fff;
  padding: 10px 15px;
  min-height: 44px;
  cursor: pointer;
  font-size: 15px;
}

.chips button.selected {
  background: var(--color-tertiary);
  color: #fff;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatches button {
  border: 2px solid transparent;
  background: none;
  padding: 5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 44px;
}

.swatches button img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--color-tertiary-lightest);
}

.swatches button.selected img {
  border-color: var(--color-tertiary);
  border-width: 2px;
}

.swatches button span {
  font-size: 12px;
}

.btn-secondary {
  align-self: flex-start;
  background: none;
  color: var(--color-tertiary);
  border: 1px solid var(--color-tertiary);
  border-radius: 0;
  padding: 12px 20px;
  font-size: 14px;
  cursor: pointer;
  min-height: 44px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-secondary:hover {
  background: var(--color-tertiary);
  color: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content img {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

.history-detail-images {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
}

.history-detail-images img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

@media (max-width: 700px) {
  .history-detail-images {
    flex-direction: column;
    align-items: center;
  }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-tertiary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.cta-generer {
  background: var(--color-tertiary);
  color: #fff;
  border: 1px solid var(--color-tertiary);
  border-radius: 0;
  padding: 15px 20px;
  font-size: 15px;
  font-weight: 500;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.cta-generer:hover:not(:disabled) {
  background: var(--color-primary);
  color: var(--color-tertiary);
}

.cta-generer:disabled {
  background: var(--color-tertiary-lightest);
  border-color: var(--color-tertiary-lightest);
  color: var(--color-tertiary-light);
  cursor: not-allowed;
}

.message-erreur {
  color: var(--color-danger);
}

.message-vide {
  color: var(--color-tertiary-light);
}

.compare-slider {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  line-height: 0;
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
}

.compare-toggle {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  line-height: 0;
  cursor: pointer;
  user-select: none;
}

.compare-after {
  position: static;
  display: block;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}

.compare-before {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
}

.zoom-image-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  line-height: 0;
  cursor: zoom-in;
  user-select: none;
}

.zoom-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  -webkit-user-drag: none;
}

.compare-before-wrap {
  position: absolute;
  inset: 0;
}

.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  transform: translateX(-50%);
  pointer-events: none;
}

.compare-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.compare-badge {
  position: absolute;
  bottom: 12px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compare-badge-before {
  left: 12px;
  background: #fff;
  color: var(--color-tertiary);
}

.compare-badge-after {
  right: 12px;
  background: var(--color-tertiary);
  color: #fff;
}

.result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 14px;
}

.result-caption {
  margin: 0;
  font-size: 14px;
  color: var(--color-tertiary-light);
}

.btn-download {
  background: var(--color-tertiary);
  color: #fff;
  border: 1px solid var(--color-tertiary);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-download:hover {
  background: var(--color-primary);
  color: var(--color-tertiary);
}

.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

.login-logo {
  height: 40px;
  width: auto;
}

.login-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  width: 100%;
}

.login-heading {
  margin: 0;
  max-width: 340px;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 22px;
  text-align: center;
}

.login-screen form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 340px;
  padding: 0;
}

.login-screen label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-tertiary-light);
}

.login-screen input {
  width: 100%;
  padding: 10px 15px;
  min-height: 44px;
  border: 1px solid var(--color-tertiary-lightest);
  font-size: 15px;
  font-family: var(--font-body);
  background: var(--color-primary);
  color: var(--color-tertiary);
}

.login-screen input:focus {
  outline: none;
  border-color: var(--color-tertiary);
  box-shadow: 0 0 0 1px var(--color-tertiary);
}

.login-password-wrap {
  position: relative;
}

.login-password-wrap input {
  padding-right: 44px;
}

.login-password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--color-tertiary);
  cursor: pointer;
}

.login-screen button[type="submit"] {
  margin-top: 6px;
  background: var(--color-tertiary);
  color: #fff;
  border: 1px solid var(--color-tertiary);
  border-radius: 0;
  padding: 15px 20px;
  font-size: 15px;
  font-weight: 500;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.login-screen button[type="submit"]:hover {
  background: var(--color-primary);
  color: var(--color-tertiary);
}

.login-error {
  margin: 0;
  font-size: 13px;
  color: var(--color-danger);
}

.login-error[hidden] {
  display: none;
}
