:root {
  /* Palette — modifiez uniquement ces variables pour changer le thème */
  --color-bg: #f5f1eb;
  --color-surface: #fffdf9;
  --color-surface-alt: #eee7dd;
  --color-primary: #6f4e37;
  --color-primary-dark: #4b3527;
  --color-accent: #b88a5a;
  --color-text: #29231f;
  --color-text-muted: #756b63;
  --color-border: #ddd3c7;
  --color-white: #ffffff;
  --color-focus: #c89b68;

  --topbar-height: 72px;
  --left-width: 300px;
  --right-width: 330px;
  --radius: 14px;
  --shadow: 0 8px 25px rgba(60, 45, 30, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== Bandeau ===== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 1.2rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  text-align: center;
}

.topnav {
  display: flex;
  justify-self: end;
  gap: 18px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.topnav a {
  display: flex;
  align-items: center;
  gap: 15px;
}

.topnav a span svg {
  height: 1.5em;
}

.topnav a:hover {
  color: var(--color-primary);
}

/* ===== Mise en page ===== */

.layout {
  display: grid;
  grid-template-columns: var(--left-width) minmax(0, 1fr) var(--right-width);
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
}

/* ===== Colonne produits ===== */

.products-panel,
.options-panel {
  min-height: 0;
  background: var(--color-surface);
}

.products-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border);
}

.panel-heading {
  flex: 0 0 auto;
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--color-border);
}

.panel-heading h2,
.options-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.panel-heading span {
  display: block;
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.product-list {
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin;
}

.product-card {
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.product-card img {
  display: block;
  width: 100%;
  height: 145px;
  object-fit: cover;
}

.product-content {
  padding: 13px;
}

.product-content h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
}

.product-content p {
  min-height: 38px;
  margin: 0 0 12px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.product-content strong {
  color: var(--color-primary);
}

/* ===== Zone centrale ===== */

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(circle at center, rgba(255,255,255,.7), transparent 60%),
    var(--color-bg);
}

.canvas {
  width: min(760px, 90%);
  height: 80vh;
  display: grid;
  place-items: center;
  background-image: url("/Ressources/Bois/Fond.jpg");
  background-size: cover;
  border: 1px dashed var(--color-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.canvas-placeholder {
  text-align: center;
  color: var(--color-text-muted);
  background-color: rgba(197, 184, 184, 0.7);
  padding: 15px;
  border-radius: 10px;
}

.canvas-placeholder h2 {
  margin: 8px 0 4px;
  color: var(--color-text);
  font-size: 1.15rem;
}

.canvas-placeholder p {
  margin: 0;
  font-size: 0.85rem;
}

.canvas-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: auto;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-primary);
  font-size: 1.3rem;
}

.canvas img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  max-width: 80vw;
  max-height: 80vh;
  object-fit: cover;
  position: absolute;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 72%;
}


#gravure {
  mask-image: url("/Ressources/Transparent.png");
  filter: contrast(200%) saturate(200%) sepia(70%) brightness(60%);
}
#contour {
  mask-image: url("/Ressources/Transparent.png");
  filter: contrast(150%) saturate(150%) sepia(50%);
}
#trou {
  mask-image: url("/Ressources/Transparent.png");
}

#porte-clé {
  filter: drop-shadow(0 0 5px black);
  width: 100%;
  height: 100%;
  position: relative;
}

/* ===== Formulaire ===== */

.options-panel {
  overflow-y: auto;
  padding: 20px;
  border-left: 1px solid var(--color-border);
}

.form-section {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}

.form-section h2 {
  margin-bottom: 15px;
}

.form-section > label:not(.choice),
.group-label {
  display: block;
  margin: 0 0 7px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 650;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  padding: 10px 11px;
  margin-bottom: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 9px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px rgba(200, 155, 104, 0.15);
}

.choice-group {
  display: grid;
  gap: 9px;
}

.group-label {
  margin-bottom: 3px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  font-size: 0.86rem;
  cursor: pointer;
}

.choice input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--color-primary);
}

.submit-button {
  width: 100%;
  padding: 12px 15px;
  border: 0;
  border-radius: 10px;
  background: var(--color-primary);
  color: var(--color-white);
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .2s;
}

.submit-button:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

/* ===== Tablette / petit écran ===== */

@media (max-width: 1050px) {
  :root {
    --left-width: 250px;
    --right-width: 290px;
  }

  .topnav {
    gap: 10px;
  }

  .topnav a:nth-child(n+3) {
    display: none;
  }

  .topnav a {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .topnav a span {
    font-size: 0.9em;
  }

  .workspace {
    padding: 18px;
  }
}

/* ===== Mobile ===== */

@media (max-width: 760px) {
  .topbar {
    position: relative;
    height: auto;
    min-height: var(--topbar-height);
    grid-template-columns: auto 1fr;
    padding: 10px 14px;
  }

  .topbar h1 {
    text-align: right;
    font-size: 0.95rem;
  }

  .topnav {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
  }

  .topnav a {
    font-size: 0.78rem;
  }

  .layout {
    height: auto;
    min-height: calc(100vh - var(--topbar-height));
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .products-panel {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--color-border);
  }

  .workspace {
    order: 1;
    min-height: 55vh;
    padding: 20px 14px;
  }

  .options-panel {
    order: 3;
    border-left: 0;
    border-top: 1px solid var(--color-border);
    overflow: visible;
  }

  .product-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 14px;
  }

  .product-card {
    flex: 0 0 230px;
    margin: 0;
  }

  .product-card img {
    height: 120px;
  }

  .canvas {
    width: 100%;
    max-width: 600px;
  }
}
