/* Brand application layer - based on the Polyhabitat 2024 guide. */
:root {
  --brand-deep: #2c2c2c;
  --brand-burgundy: #830a2c;
  --brand-greige: #997e50;
  --brand-paper: #fffaf7;
  --brand-sand: #e1d8d0;
  --brand-shadow: 0 18px 48px rgba(44, 44, 44, 0.1);
}

body.configurator-embed {
  color: var(--brand-deep);
  background:
    radial-gradient(circle at 6% 4%, rgba(153, 126, 80, 0.14), transparent 24rem),
    linear-gradient(135deg, #fff 0%, var(--brand-paper) 52%, #f4ece6 100%);
}

.configurator-home {
  background:
    linear-gradient(90deg, rgba(131, 10, 44, 0.94), rgba(131, 10, 44, 0.86)),
    linear-gradient(135deg, #2c2c2c, #997e50);
}

.configurator-home-card {
  border: 0;
  border-radius: 28px;
  box-shadow: 0 28px 80px rgba(28, 12, 18, 0.28);
}

.configurator-home-logo {
  display: block;
  width: min(210px, 56%);
  height: auto;
  margin: 0 0 22px;
}

.configuration-modal-card {
  background: linear-gradient(180deg, #fff 0%, #fffaf7 100%);
}

.configuration-modal-header {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 8px 8px 14px;
  border-bottom: 1px solid var(--brand-sand);
}

.configuration-modal-heading {
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.configuration-brand-logo {
  width: 126px;
  height: 38px;
  padding: 4px 7px;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
}

.configuration-modal-heading h3 {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.configuration-back-button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid rgba(131, 10, 44, 0.18);
  border-radius: 10px;
  background: #fff;
}

.configuration-back-button:hover,
.configuration-back-button:focus-visible {
  color: #fff;
  background: var(--brand-burgundy);
}

.configurator-embed .primary-button,
.configurator-embed .opening-visual-position-button.is-active {
  box-shadow: 0 8px 18px rgba(131, 10, 44, 0.18);
}

.configurator-embed .secondary-button {
  border-color: rgba(153, 126, 80, 0.28);
  background: #fff;
}

.configurator-embed .secondary-button:hover,
.configurator-embed .secondary-button:focus-visible {
  border-color: var(--brand-burgundy);
  color: var(--brand-burgundy);
  background: #fff7f3;
}

.openings-list-section,
.configuration-message-section,
.configuration-footer-bar {
  border-color: var(--brand-sand);
  box-shadow: 0 10px 26px rgba(44, 44, 44, 0.035);
}

.opening-card,
.configuration-draft {
  border-color: rgba(153, 126, 80, 0.25);
}

@media (max-width: 760px) {
  .configuration-brand-logo { width: 108px; height: 34px; }
  .configuration-modal-heading { gap: 8px; }
}

/* Configurator workspace: same hierarchy as the distributor portal. */
.configurator-home {
  background: #f5f3f1;
}

.configurator-home-card {
  width: min(980px, 100%);
  padding: clamp(30px, 5vw, 58px);
  border-left: 7px solid var(--brand-burgundy);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--brand-shadow);
}

.configurator-home-card h1 {
  max-width: 16ch;
  font-family: "Montserrat", sans-serif;
  letter-spacing: -0.04em;
}

.configurator-draft {
  border-radius: 9px;
  background: #fffdfc;
}

.configurator-draft:hover {
  border-color: var(--brand-burgundy);
  box-shadow: 0 10px 22px rgba(44, 44, 44, 0.08);
}

.configurator-embed .configuration-modal-card {
  gap: 0;
  padding: 0;
  background: #f5f3f1;
}

.configurator-embed .configuration-modal-header {
  min-height: 78px;
  padding: 14px clamp(18px, 3vw, 42px);
  color: #fff;
  border: 0;
  background: linear-gradient(116deg, #2c2c2c, #50061c 62%, #830a2c);
}

.configuration-modal-heading h3 {
  color: #fff;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
}

.configuration-back-button {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.08);
}

.configuration-back-button:hover,
.configuration-back-button:focus-visible {
  color: var(--brand-deep);
  border-color: #fff;
  background: #fff;
}

.configuration-modal-layout {
  padding: 22px clamp(18px, 3vw, 42px) 18px;
  gap: 14px;
}

.configuration-overview-actions .openings-toolbar {
  justify-self: stretch;
}

.openings-list-header {
  padding-bottom: 2px;
}

.list-count {
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--brand-burgundy);
  background: #f1e8e4;
  font-size: 0.78rem;
  font-weight: 750;
}

.openings-list-section {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.opening-card {
  padding: 16px 18px;
  border: 1px solid #e4ded9;
  border-left: 4px solid var(--brand-greige);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.opening-card:hover {
  transform: translateY(-1px);
  border-color: #c9bbb1;
  border-left-color: var(--brand-burgundy);
  box-shadow: 0 12px 24px rgba(44, 44, 44, 0.07);
}

.opening-card-visual {
  border-radius: 8px;
  background: #f7f3f0;
}

.opening-card-repere,
.opening-card-spec strong {
  color: var(--brand-burgundy);
}

.opening-card-actions .secondary-button,
.opening-card-actions .ghost-button {
  border-radius: 7px;
}

.configuration-message-section {
  padding: 18px;
  border: 1px solid #e4ded9;
  border-left: 4px solid var(--brand-greige);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

.configuration-footer-bar {
  padding: 14px 16px;
  border: 1px solid #e2d8d2;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(44, 44, 44, 0.07);
}

.configuration-footer-actions .primary-button,
.configuration-footer-actions .secondary-button {
  min-height: 44px;
  border-radius: 8px;
}

/* Opening editor: dark contextual header, visual plan on a dedicated surface
   and quieter form sections with a clear progress state. */
.opening-modal-card {
  gap: 0;
  padding: 0;
  border-radius: 14px;
  background: #f5f3f1;
}

.opening-modal-card > .modal-header {
  margin: 0;
  padding: 18px 26px;
  color: #fff;
  border: 0;
  background: linear-gradient(116deg, #2c2c2c, #50061c 62%, #830a2c);
}

.opening-modal-card > .modal-header .eyebrow {
  color: #e8cbd5;
}

.opening-modal-card > .modal-header h3 {
  color: #fff;
  letter-spacing: -0.025em;
}

.opening-modal-card > .modal-header .ghost-button {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.08);
}

.opening-modal-card > .modal-header .ghost-button:hover,
.opening-modal-card > .modal-header .ghost-button:focus-visible {
  color: var(--brand-deep);
  background: #fff;
}

.opening-form {
  padding: 20px 26px 18px;
}

.opening-visual-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.opening-visual-header {
  padding-bottom: 14px;
  border-bottom: 1px solid #eee8e4;
}

.opening-visual-header .eyebrow,
.opening-visual-metric strong {
  color: var(--brand-burgundy);
}

.opening-visual-summary {
  max-width: 430px;
  margin: 10px 0 0;
  color: #6a625d;
  font-size: 0.82rem;
  line-height: 1.4;
}

.opening-visual-stage {
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.opening-visual-frame,
.opening-visual-canvas {
  min-height: 0;
}

.opening-visual-frame {
  height: 100%;
  border-radius: 7px;
}

.opening-visual-canvas {
  height: 100%;
  aspect-ratio: 1000 / 760;
}

.opening-form-sections {
  gap: 10px;
}

.opening-group {
  border: 1px solid #e4ded9;
  border-left: 4px solid #d3c5bb;
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

.opening-group.is-open {
  border-color: #cfbdb3;
  border-left-color: var(--brand-burgundy);
  box-shadow: 0 10px 24px rgba(44, 44, 44, 0.06);
}

.opening-group.is-complete {
  border-color: #bdd7c9;
  border-left-color: #277b53;
  background: #fff;
}

.opening-group.is-complete:not(.is-open) .opening-group-toggle {
  min-height: 48px;
  background: #f3faf6;
}

.opening-group.is-complete:not(.is-open) .opening-group-main h4 {
  color: #277b53;
}

.opening-group.is-progress {
  border-color: #e2d0ad;
  border-left-color: var(--brand-greige);
  background: #fff;
}

.opening-group:not(.is-open).is-complete .opening-group-toggle,
.opening-group:not(.is-open).is-progress .opening-group-toggle {
  background: transparent;
}

.opening-group-toggle:hover {
  background: #fcfaf9;
}

.opening-group.is-open .opening-group-toggle {
  padding: 16px 18px 13px;
}

.opening-group-body {
  padding: 0 18px 18px;
  border-top: 1px solid #f0ebe7;
}

.opening-group-status {
  border-radius: 999px;
}

.opening-group-next-button {
  border-radius: 8px;
  background: var(--brand-burgundy);
}

.opening-group-next-button:hover,
.opening-group-next-button:focus-visible {
  background: #650720;
}

.opening-form-panel .field input,
.opening-form-panel .field select,
.opening-form-panel .field textarea {
  border-color: #dcd5d0;
  border-radius: 8px;
  background: #fffdfc;
}

.opening-form-panel .field input:focus,
.opening-form-panel .field select:focus,
.opening-form-panel .field textarea:focus {
  border-color: var(--brand-burgundy);
  outline: 3px solid rgba(131, 10, 44, 0.11);
}

.opening-form .modal-actions {
  padding-top: 14px;
  border-top: 1px solid #e8e0db;
}

.opening-form .modal-actions .primary-button,
.opening-form .modal-actions .secondary-button,
.opening-form .modal-actions .ghost-button {
  min-height: 42px;
  border-radius: 8px;
}

/* Dense, predictable controls: choices stay readable without dominating the editor. */
.opening-form-panel .opening-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px 14px;
}

.opening-form-panel .field {
  gap: 5px;
}

.opening-form-panel .field > span,
.opening-form-panel .field legend {
  min-height: 1.15em;
  font-size: 0.76rem;
  line-height: 1.2;
}

.opening-form-panel .field input:not([type="checkbox"]),
.opening-form-panel .field select,
.opening-form-panel .field textarea,
.opening-form-panel .opening-select-trigger {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 0.86rem;
}

.opening-form-panel .opening-select-display {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opening-form-panel .selection-badges {
  gap: 6px;
}

.opening-form-panel .selection-badge span {
  min-width: 0;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 0.8rem;
  line-height: 1.15;
  white-space: nowrap;
}

.opening-form-panel .field.checkbox-field {
  gap: 7px;
  min-height: 36px;
}

.opening-form-panel .field.checkbox-field input {
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  height: 18px;
}

.opening-form-panel .field.checkbox-field input::after {
  width: 12px;
  height: 12px;
  left: 3px;
}

.opening-form-panel .field.checkbox-field input:checked::after {
  transform: translate(12px, -50%);
}

/* Binary choices use a light, low-profile toggle. */
.opening-form-panel .field.checkbox-field {
  align-items: center;
  min-height: 28px;
  gap: 7px;
}

.opening-form-panel .field.checkbox-field input {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  height: 12px;
  border: 1px solid #d7d0ca;
  border-radius: 999px;
  background: #e4dfda;
  box-shadow: none;
}

.opening-form-panel .field.checkbox-field input::after {
  top: 50%;
  left: 1px;
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  transform: translateY(-50%);
}

.opening-form-panel .field.checkbox-field input:hover {
  border-color: var(--brand-burgundy);
  box-shadow: 0 0 0 3px rgba(131, 10, 44, 0.06);
}

.opening-form-panel .field.checkbox-field input:checked {
  border-color: var(--brand-burgundy);
  background: var(--brand-burgundy);
  box-shadow: none;
}

.opening-form-panel .field.checkbox-field input:checked::after {
  transform: translate(22px, -50%);
}

/* Selects remain utilitarian: one compact line and a discreet chevron. */
.opening-form-panel .opening-select-trigger {
  min-height: 32px;
  padding: 5px 8px 5px 10px;
  gap: 6px;
  border-color: #e4d9d1;
  border-radius: 6px;
  box-shadow: none;
}

.opening-form-panel .opening-select-caret {
  position: relative;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border-radius: 0;
  background: transparent;
  color: var(--brand-burgundy);
  font-size: 0;
}

.opening-form-panel .opening-select-caret::before {
  position: absolute;
  top: 50%;
  left: 50%;
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translate(-50%, -64%) rotate(45deg);
}

.opening-form-panel .opening-select-editor.is-open .opening-select-caret {
  transform: none;
}

.opening-form-panel .opening-select-editor.is-open .opening-select-caret::before {
  transform: translate(-50%, -36%) rotate(225deg);
}

.opening-form-panel .opening-select-option {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 0.82rem;
}

/* Both accordion and select chevrons share the same visual centre. */
.opening-group-chevron {
  position: relative;
  display: grid;
  place-items: center;
  align-self: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  line-height: 1;
  transform: none;
}

.opening-group-chevron::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  font-size: 0;
  transform: translate(-50%, -64%) rotate(45deg);
}

.opening-group.is-open .opening-group-chevron {
  transform: none;
}

.opening-group.is-open .opening-group-chevron::before {
  transform: translate(-50%, -36%) rotate(225deg);
}

@media (max-width: 920px) {
  .opening-form-panel .opening-grid {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 10px;
  }
}

@media (max-width: 760px) {
  .configurator-home-card {
    padding: 28px 22px;
  }

  .configuration-modal-layout {
    padding: 14px;
  }

  .opening-modal-card > .modal-header,
  .opening-form {
    padding-inline: 16px;
  }

  .opening-visual-card {
    padding: 14px;
  }

  .opening-visual-stage {
    padding: 8px;
  }
}
