/* ─── CUSTOM PROPERTIES ──────────────────────────────────────────────────── */
:root {
  --bg:        #F4F2EA;
  --dark:      #1C1A18;
  --white:     #FFFFFF;
  --red:       #CC3311;
  --border:    #D5D0C8;
  --muted:     #9B9B8E;
  --input-bg:  #FAFAF7;
  --radius:    5px;
  --tr:        0.15s ease;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
}

/* ─── RESET & BASE ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--dark);
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── PAGE WRAPPER ───────────────────────────────────────────────────────── */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 48px 80px;
}

main { position: relative; }

/* ─── TOP NAV BAR ────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 0 0;
  margin-bottom: 48px;
}

.topbar__left {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.topbar__left .dot {
  margin-top: 3px;
}

.topbar__left-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar__label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dark);
}

.topbar__order-num {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.topbar__logo {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dark);
}

/* ─── RED DOT ────────────────────────────────────────────────────────────── */
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}

/* ─── STATE VISIBILITY ───────────────────────────────────────────────────── */
main > section { display: none; }

main[data-state="loading"]           #state-loading           { display: block; }
main[data-state="not-found"]         #state-not-found         { display: block; }
main[data-state="already-submitted"] #state-already-submitted { display: block; }
main[data-state="all-submitted"]     #state-all-submitted     { display: block; }
main[data-state="form"]              #state-form              { display: block; }

/* ─── CENTER STATES ──────────────────────────────────────────────────────── */
.center-state {
  text-align: center;
  padding: 80px 0;
}

.center-state--pad { padding: 60px 0; text-align: left; }

.center-state__msg {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}

.center-state__eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 10px;
}

.center-state__heading {
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 12px;
}

.center-state__body {
  font-size: 14px;
  color: var(--muted);
  max-width: 420px;
}

/* ─── ALL SUBMITTED STATE ────────────────────────────────────────────────── */
.all-submitted {
  text-align: center;
  padding: 80px 0;
}

.all-submitted__icon {
  width: 84px;
  height: 84px;
  background: #3A8A4E;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 32px;
}

.all-submitted__icon--gray {
  background: #BBBAB3;
}

.all-submitted__heading {
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--dark);
  margin-bottom: 12px;
}

.all-submitted__body {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 28px;
}

.all-submitted__order {
  font-size: 13px;
  color: var(--dark);
  margin-bottom: 6px;
}

.all-submitted__close {
  font-size: 12px;
  color: var(--muted);
}

/* ─── SUCCESS CHIP ───────────────────────────────────────────────────────── */
.success-chip {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #F1FBF3;
  border: 1px solid #AADDB6;
  border-radius: var(--radius);
  padding: 18px 20px;
  max-width: 460px;
}

.success-chip__icon {
  font-size: 17px;
  color: #38A169;
  line-height: 1.3;
  flex-shrink: 0;
}

.success-chip__heading {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 3px;
}

.success-chip__body {
  font-size: 13px;
  color: var(--muted);
}

/* ─── SPINNER ────────────────────────────────────────────────────────────── */
.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-top-color: var(--dark);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── HERO ───────────────────────────────────────────────────────────────── */
.hero { margin-bottom: 44px; }

.hero__heading {
  font-size: 42px;
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--dark);
  margin-bottom: 16px;
}

.hero__sub {
  font-size: 14px;
  color: var(--muted);
  max-width: 500px;
  line-height: 1.6;
}

/* ─── DIVIDER ────────────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ─── SECTION ROW ────────────────────────────────────────────────────────── */
.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dark);
}

.section-meta {
  font-size: 11px;
  color: var(--muted);
}

.section-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  margin-top: -12px;
}

/* ─── ORDER DETAILS ──────────────────────────────────────────────────────── */
.order-details-table {
  border-left: 2px solid var(--red);
  padding: 4px 20px;
  background: var(--white);
  border-radius: var(--radius);
}

.order-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.order-row:last-child { border-bottom: none; }

.order-row__key {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.order-row__val {
  font-size: 13px;
  color: var(--dark);
  text-align: right;
  word-break: break-word;
}

/* ─── PRODUCT CARDS ──────────────────────────────────────────────────────── */
.product-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--white);
}

.product-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--white);
  transition: background var(--tr);
}

.product-card__header:hover { background: rgba(28, 26, 24, 0.02); }

.product-card__header:focus-visible {
  outline: 2px solid var(--dark);
  outline-offset: -2px;
}

/* Thumbnail — visible only when collapsed */
.product-card__thumb {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
  background: #EAE7DF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--tr);
}

.product-card.is-open .product-card__thumb { display: none; }

.product-card__thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card__thumb-placeholder {
  font-size: 9px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.product-card__info {
  flex: 1;
  min-width: 0;
}

.product-card__counter {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.product-card__name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── STATUS BADGES ──────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge--pending {
  background: #EEEDE8;
  color: var(--muted);
}

.status-badge--in-progress {
  background: var(--dark);
  color: var(--white);
}

.status-badge--submitted {
  background: #EBF5EE;
  color: #2A7A42;
  border: 1px solid #B8DFC4;
}

/* ─── CHEVRON ────────────────────────────────────────────────────────────── */
.product-card__chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease;
  display: block;
}

.product-card.is-open .product-card__chevron {
  transform: rotate(180deg);
}

/* ─── CARD BODY ──────────────────────────────────────────────────────────── */
.product-card__body {
  border-top: 1px solid var(--border);
  padding: 20px;
}

/* ─── SPECS SECTION ──────────────────────────────────────────────────────── */
.product-specs { margin-bottom: 24px; }

.product-specs__label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.specs-layout {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 16px;
  align-items: start;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.spec-row:first-child { border-top: 1px solid var(--border); }

.spec-row__key { color: var(--muted); flex-shrink: 0; }
.spec-row__val { color: var(--dark); text-align: right; }

.specs-photo {
  aspect-ratio: 1;
  background: #EAE7DF;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.specs-photo__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.specs-photo__placeholder {
  font-size: 11px;
  color: var(--muted);
}

/* ─── CLIENT SPECS SECTION ───────────────────────────────────────────────── */
.client-specs-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 4px;
}

.client-specs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.client-specs-header .section-meta {
  font-size: 10px;
  color: var(--muted);
}

/* ─── FORM FIELDS ────────────────────────────────────────────────────────── */
.field-group { margin-bottom: 22px; }

.field-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.field-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dark);
}

/* ─── BADGES ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  line-height: 1.8;
}

.badge--required {
  border: 1px solid var(--red);
  color: var(--red);
}

.badge--optional {
  border: 1px solid var(--muted);
  color: var(--muted);
}

/* ─── INPUTS ─────────────────────────────────────────────────────────────── */
input[type="text"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  background: var(--input-bg);
  color: var(--dark);
  outline: none;
  transition: border-color var(--tr);
}

input[type="text"]::placeholder,
textarea::placeholder { color: var(--muted); }

input[type="text"]:focus,
textarea:focus { border-color: var(--dark); }

textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

/* ─── FIELD HINT & ERROR ─────────────────────────────────────────────────── */
.field-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

.field-error {
  font-size: 11px;
  color: var(--red);
  margin-top: 5px;
}

.field-group.has-error input[type="text"],
.field-group.has-error textarea { border-color: var(--red); }

.field-group.has-error .dropzone { border-color: var(--red); }

.field-group.has-error .toggle-btn:not(.active) { border-color: var(--red); }

/* ─── DROPZONE ───────────────────────────────────────────────────────────── */
.dropzone {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--tr), background var(--tr);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--dark);
  background: rgba(28, 26, 24, 0.03);
}

.dropzone:focus-visible {
  outline: 2px solid var(--dark);
  outline-offset: 2px;
}

.dropzone input[type="file"] { display: none; }

.dropzone__icon {
  color: var(--muted);
  display: block;
  margin: 0 auto 10px;
  stroke-width: 1.4;
}

.dropzone__main {
  font-size: 13px;
  font-weight: 400;
  color: var(--dark);
  margin-bottom: 4px;
}

.dropzone__types {
  font-size: 11px;
  color: var(--muted);
}

/* ─── FILE LIST ──────────────────────────────────────────────────────────── */
.file-list { list-style: none; margin-top: 8px; }

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.file-list li:last-child { border-bottom: none; }

.file-list__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dark);
}

.file-list__size {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.file-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  padding: 0 2px;
  flex-shrink: 0;
  transition: color var(--tr);
}

.file-remove-btn:hover { color: var(--red); }

/* ─── TOGGLE BUTTONS (Embellishment) ─────────────────────────────────────── */
.toggle-group {
  display: flex;
  gap: 0;
}

.toggle-btn {
  flex: 1;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-right: none;
  background: var(--input-bg);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dark);
  cursor: pointer;
  transition: background var(--tr), color var(--tr), border-color var(--tr);
}

.toggle-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.toggle-btn:last-child  { border-radius: 0 var(--radius) var(--radius) 0; border-right: 1px solid var(--border); }

.toggle-btn:hover:not(:disabled):not(.active) { border-color: var(--dark); z-index: 1; position: relative; }

.toggle-btn.active {
  background: #C62B1E;
  color: var(--white);
  border-color: #C62B1E;
  position: relative;
  z-index: 1;
}

.toggle-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── PRODUCT CARD FOOTER ────────────────────────────────────────────────── */
.product-card__footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── SUBMIT PRODUCT BUTTON ──────────────────────────────────────────────── */
.submit-product-btn {
  padding: 12px 22px;
  background: var(--dark);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity var(--tr);
}

.submit-product-btn:hover:not(:disabled) { opacity: 0.82; }
.submit-product-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ─── LEADTIME ───────────────────────────────────────────────────────────── */
.leadtime {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.leadtime__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dark);
  margin-bottom: 6px;
}

.leadtime__body {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ─── GLOBAL ERROR BANNER ────────────────────────────────────────────────── */
.global-error-banner {
  background: #FFF5F5;
  border: 1px solid #FEB2B2;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--red);
  margin-bottom: 16px;
}

/* ─── MOBILE ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .page { padding: 0 20px 64px; }

  .topbar { margin-bottom: 32px; }

  .hero__heading { font-size: 30px; }

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

  .specs-photo { aspect-ratio: unset; height: 100px; }

  .toggle-group { flex-direction: column; }

  .toggle-btn {
    border-right: 1px solid var(--border);
    border-bottom: none;
    border-radius: 0 !important;
  }

  .toggle-btn:first-child { border-radius: var(--radius) var(--radius) 0 0 !important; }
  .toggle-btn:last-child  { border-radius: 0 0 var(--radius) var(--radius) !important; border-bottom: 1px solid var(--border); }
  .toggle-btn.active { border-color: var(--dark) !important; }
}

@media (max-width: 400px) {
  .hero__heading { font-size: 26px; }
}
