/* ====================================================================
   ADEGA DEMETRIUS — Sistema Directo con Bodega
   Paleta: pergamino cálido, tinta, vino, bronce — tomada de las
   propias etiquetas (sello de lacre, medallas de oro, papel crudo).
   ==================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,500&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --cream:        #F3EEE4;
  --cream-dark:   #E7DFCE;
  --paper:        #FBF8F2;
  --ink:          #211C18;
  --ink-soft:     #524A42;
  --wine:         #7A1F2B;
  --wine-dark:    #58141D;
  --brick:        #A63328;
  --bronze:       #B8925A;
  --bronze-light: #D8BE94;
  --slate:        #3B4A5A;
  --line:         #D9CFBB;
  --white:        #FFFFFF;
  --ok:           #3F6B4A;
  --warn:         #A6572B;

  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-s: 3px;
  --radius-m: 6px;
  --shadow-card: 0 1px 2px rgba(33,28,24,0.06), 0 6px 20px rgba(33,28,24,0.06);
  --shadow-pop: 0 12px 40px rgba(33,28,24,0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.oculto { display: none !important; }

/* ---------------------------------------------------------------- */
/* Encabezado                                                        */
/* ---------------------------------------------------------------- */

.top-bar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.top-bar__inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 20px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.brand__logo { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }

.brand__text { min-width: 0; }

.brand__eyebrow {
  font-family: var(--font-body);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bronze);
  font-weight: 600;
}

.brand__name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lock-btn {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: border-color .15s, background .15s;
}
.lock-btn:hover { border-color: var(--bronze); }
.lock-btn[data-unlocked="true"] {
  background: var(--wine);
  border-color: var(--wine);
}

/* ---------------------------------------------------------------- */
/* Navegación por pestañas (pasos)                                   */
/* ---------------------------------------------------------------- */

.tabs {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  padding: 0 20px;
  overflow-x: auto;
}

.tab-btn {
  border: none;
  background: none;
  padding: 14px 4px;
  margin-right: 28px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s, opacity .15s;
}

.tab-btn__seal {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.3px solid var(--bronze);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  color: var(--bronze);
  flex-shrink: 0;
}

.tab-btn__label {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tab-btn:hover:not(:disabled) { color: var(--ink); }

.tab-btn[aria-selected="true"] {
  color: var(--wine);
  border-bottom-color: var(--wine);
}
.tab-btn[aria-selected="true"] .tab-btn__seal {
  background: var(--wine);
  border-color: var(--wine);
  color: var(--white);
}

.tab-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------- */
/* Layout general                                                    */
/* ---------------------------------------------------------------- */

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 120px;
}

.panel { display: none; }
.panel[aria-hidden="false"] { display: block; animation: fadeIn .25s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------- */
/* Tab 1 — Cómo funciona                                             */
/* ---------------------------------------------------------------- */

.hero {
  padding: 10px 0 40px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}

.hero__eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bronze);
  font-weight: 700;
  margin: 0 0 10px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  margin: 0 0 18px;
  line-height: 1.15;
  max-width: 16ch;
}

.hero p {
  max-width: 56ch;
  color: var(--ink-soft);
  font-size: 15.5px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-bottom: 44px;
}

@media (max-width: 780px) {
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .steps { grid-template-columns: 1fr; }
}

.step-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 22px 18px;
  position: relative;
}

.step-card__seal {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.4px solid var(--wine);
  color: var(--wine);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 14px;
}

.step-card h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 6px;
}

.step-card p {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0;
}

.next-cta {
  display: flex;
  justify-content: center;
}

/* ---------------------------------------------------------------- */
/* Botones                                                           */
/* ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-s);
  padding: 13px 26px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1.4px solid transparent;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--wine);
  color: var(--white);
}
.btn--primary:hover { background: var(--wine-dark); }
.btn--primary:disabled { background: var(--ink-soft); opacity: .4; cursor: not-allowed; }

.btn--ghost {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.btn--ghost:hover { background: var(--ink); color: var(--white); }

.btn--outline {
  background: var(--white);
  border-color: var(--line);
  color: var(--ink);
}
.btn--outline:hover { border-color: var(--bronze); }

.btn--sm { padding: 8px 14px; font-size: 12.5px; }
.btn--full { width: 100%; }

/* ---------------------------------------------------------------- */
/* Tab 2 — Catálogo                                                   */
/* ---------------------------------------------------------------- */

.catalog-intro { margin-bottom: 30px; }
.catalog-intro h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 6px;
}
.catalog-intro p { color: var(--ink-soft); margin: 0; max-width: 60ch; }

.category-block { margin-bottom: 40px; }

.category-block__title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.category-block__title h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.category-block__title .rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.product-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, box-shadow .15s;
}
.product-card:hover { box-shadow: var(--shadow-card); border-color: var(--bronze-light); }

.product-card__img-wrap {
  aspect-ratio: 3 / 4;
  background: var(--cream-dark);
  overflow: hidden;
  position: relative;
}
.product-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card__img-wrap img.medal-badge {
  position: absolute;
  top: 8px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  border: 1.5px solid rgba(255,255,255,0.85);
  background: #fff;
  object-fit: cover;
}

.medal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.medal-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--wine);
  background: var(--cream-dark);
  border: 1px solid var(--bronze);
  border-radius: 999px;
  padding: 3px 9px;
}

.product-card__body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15.5px;
  line-height: 1.25;
}

.product-card__meta {
  font-size: 11.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.product-card__price {
  font-weight: 700;
  color: var(--wine);
  font-size: 16px;
  margin-top: 2px;
}
.product-card__price small {
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 11.5px;
  text-transform: none;
  letter-spacing: 0;
}

.product-card__min {
  font-size: 11px;
  color: var(--warn);
  min-height: 14px;
}

.qty-stepper {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  align-items: center;
  gap: 0;
  border-top: 1px solid var(--line);
}

.qty-stepper button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 16px;
  color: var(--ink);
  border-radius: var(--radius-s);
  line-height: 1;
}
.qty-stepper button:hover { border-color: var(--wine); color: var(--wine); }
.qty-stepper button:disabled { opacity: .3; cursor: not-allowed; }

.qty-stepper__value {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 14.5px;
}
.qty-stepper__value span {
  display: block;
  font-weight: 400;
  font-size: 10px;
  color: var(--ink-soft);
  text-transform: uppercase;
}

/* barra flotante del carrito */
.cart-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--ink);
  color: var(--white);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  z-index: 40;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.18);
  transform: translateY(110%);
  transition: transform .25s ease;
}
.cart-bar[data-visible="true"] { transform: translateY(0); }

.cart-bar__inner {
  max-width: 980px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.cart-bar__summary { font-size: 14px; }
.cart-bar__summary strong { font-family: var(--font-display); font-size: 17px; margin-left: 6px; }

.cart-bar .btn--primary { background: var(--bronze); color: var(--ink); }
.cart-bar .btn--primary:hover { background: var(--bronze-light); }

/* ---------------------------------------------------------------- */
/* Tab 3 — Tu pedido                                                  */
/* ---------------------------------------------------------------- */

.order-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 24px;
}

.order-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--paper);
}

table.order-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.order-table thead th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  background: var(--cream-dark);
  padding: 10px 12px;
  font-weight: 700;
}
.order-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
.order-table tfoot td {
  border-top: 1.4px solid var(--ink);
  font-weight: 700;
  padding-top: 12px;
}
.order-table .num { text-align: right; white-space: nowrap; }
.order-table .prod-name { font-weight: 600; }
.order-table .prod-format { color: var(--ink-soft); font-size: 12px; font-weight: 400; display: block; }

.line-qty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.line-qty button {
  width: 24px; height: 24px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-s);
}
.line-qty__val { min-width: 26px; text-align: center; font-weight: 600; }

.price-input {
  width: 76px;
  padding: 5px 7px;
  border: 1px solid var(--bronze);
  border-radius: var(--radius-s);
  font-size: 13px;
  text-align: right;
  font-family: var(--font-body);
}

.remove-line {
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 16px;
  padding: 2px 6px;
}
.remove-line:hover { color: var(--wine); }

.empty-note {
  padding: 30px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
}

.iva-note {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin: 6px 0 32px;
}

/* Formulario */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 30px;
}
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

.form-grid .full { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field label .req { color: var(--wine); }

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--white);
  color: var(--ink);
}
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--wine); }

.field textarea { resize: vertical; min-height: 76px; }

.field-error {
  font-size: 11.5px;
  color: var(--wine);
  margin-top: 4px;
  min-height: 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ---------------------------------------------------------------- */
/* Tab 4 — Confirmación / Documento                                   */
/* ---------------------------------------------------------------- */

.confirm-head {
  text-align: center;
  margin-bottom: 30px;
}

.confirm-seal {
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 2px solid var(--wine);
  color: var(--wine);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-family: var(--font-display);
  font-size: 28px;
}

.confirm-head h1 {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0 0 8px;
}
.confirm-head p { color: var(--ink-soft); margin: 0; }

.status-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 18px 0 34px;
}
.status-chip {
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.status-chip[data-state="ok"] { color: var(--ok); border-color: var(--ok); }
.status-chip[data-state="warn"] { color: var(--warn); border-color: var(--warn); }
.status-chip[data-state="pending"] { color: var(--ink-soft); }

.doc-sheet {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 34px;
  max-width: 640px;
  margin: 0 auto 30px;
  box-shadow: var(--shadow-card);
}

.doc-sheet__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.doc-sheet__brand { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.doc-sheet__brand small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; max-width: 34ch; }

.doc-sheet__meta { text-align: right; font-size: 12.5px; color: var(--ink-soft); }
.doc-sheet__meta strong { display: block; color: var(--ink); font-size: 15px; font-family: var(--font-display); }

.doc-sheet__client { margin-bottom: 18px; font-size: 13px; }
.doc-sheet__client h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--bronze); }

.doc-sheet table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 18px; }
.doc-sheet thead th { text-align: left; font-size: 10px; text-transform: uppercase; color: var(--ink-soft); padding: 6px 4px; border-bottom: 1.4px solid var(--ink); }
.doc-sheet td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.doc-sheet .num { text-align: right; }
.doc-sheet tfoot td { border-bottom: none; padding-top: 10px; }
.doc-sheet tfoot .total-row td { font-weight: 700; font-size: 15px; border-top: 1.4px solid var(--ink); padding-top: 10px; }

.doc-sheet__pay {
  background: var(--cream);
  border: 1px dashed var(--bronze);
  border-radius: var(--radius-s);
  padding: 16px 18px;
  font-size: 13px;
}
.doc-sheet__pay h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--wine); }
.doc-sheet__pay .iban-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: 'Courier New', monospace; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.doc-sheet__pay .copy-btn { font-size: 11px; padding: 4px 9px; }

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.confirm-foot-note {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  max-width: 50ch;
  margin: 20px auto 0;
}

/* ---------------------------------------------------------------- */
/* Panel de configuración (candado)                                   */
/* ---------------------------------------------------------------- */

.config-overlay {
  position: fixed;
  inset: 0;
  background: rgba(33,28,24,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 100;
}

.config-panel {
  background: var(--paper);
  border-radius: var(--radius-m);
  max-width: 640px;
  width: 100%;
  padding: 30px;
  box-shadow: var(--shadow-pop);
}

.config-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.config-panel h2 { font-family: var(--font-display); font-size: 21px; margin: 0; }
.config-panel__close { border: none; background: none; font-size: 22px; color: var(--ink-soft); line-height: 1; padding: 4px; }

.config-panel__sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 24px; }

.config-section { margin-bottom: 26px; }
.config-section h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--bronze); margin: 0 0 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px;
}

.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .config-grid { grid-template-columns: 1fr; } }
.config-grid .full { grid-column: 1 / -1; }

.price-editor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.price-editor-row:last-child { border-bottom: none; }

.config-panel__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.help-text {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.help-text a { color: var(--wine); }

/* ---------------------------------------------------------------- */
/* Utilidades / footer                                               */
/* ---------------------------------------------------------------- */

.footer-note {
  text-align: center;
  padding: 30px 20px 50px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--white);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200;
  white-space: nowrap;
}
.toast[data-show="true"] {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
