/* Estilos base compartidos (catálogo y panel). Los valores salen de theme.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--space-3); font-weight: var(--font-weight-strong); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 var(--space-3); }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--space-4); }
.muted { color: var(--color-text-muted); }
.subtle { color: var(--color-text-subtle); font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap); padding: 0 var(--space-4);
  border-radius: var(--radius); border: 1px solid var(--color-border-strong);
  background: var(--color-surface); color: var(--color-text);
  font: inherit; font-weight: var(--font-weight-strong); font-size: .95rem;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--color-text-subtle); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--color-surface-muted); border-color: transparent; }
.btn-danger { color: var(--color-danger); }
.btn-sm { min-height: 36px; padding: 0 var(--space-3); font-size: .875rem; }
.btn-block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field > label, .label { font-weight: var(--font-weight-strong); font-size: .925rem; }
.hint { font-size: .85rem; color: var(--color-text-muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text); font: inherit;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--color-focus); outline-offset: 0; border-color: var(--color-focus); }
.row { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .row-2 { grid-template-columns: 1fr 1fr; } .row-3 { grid-template-columns: 1fr 1fr 1fr; } }
.radio, .check { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-2) 0; cursor: pointer; }
.radio input, .check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--color-primary); }
.money { position: relative; }
.money > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; font-size: .95rem; }
.money > input { padding-left: calc(12px + var(--money-pad, 3ch)); }

/* Etiquetas */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: var(--font-weight-strong);
  background: var(--color-surface-muted); color: var(--color-text-muted); border: 1px solid var(--color-border);
  white-space: nowrap;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); border-color: transparent; }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); border-color: transparent; }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); border-color: transparent; }

/* Avisos (toast) */
.toasts { position: fixed; left: 50%; bottom: var(--space-5); transform: translateX(-50%); z-index: 100; display: grid; gap: var(--space-2); width: min(92vw, 420px); }
.toast { background: var(--color-text); color: #fff; padding: 12px 16px; border-radius: var(--radius); font-size: .95rem; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.toast-error { background: var(--color-danger); }

/* Diálogos */
dialog {
  border: none; border-radius: var(--radius-lg); padding: 0; width: min(94vw, 520px);
  max-height: 92vh; background: var(--color-surface); color: var(--color-text);
}
dialog.wide { width: min(96vw, 980px); }
dialog::backdrop { background: rgba(30, 28, 25, .45); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-4) 0; }
.dlg-head h2 { margin: 0; }
.dlg-body { padding: var(--space-4); overflow: auto; }
.dlg-foot { display: flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; padding: 0 var(--space-4) var(--space-4); }

.empty { text-align: center; padding: var(--space-6) var(--space-4); color: var(--color-text-muted); }
.error-text { color: var(--color-danger); font-size: .9rem; }

/* Ficha de producto (compartida con la vista previa del panel) */
.pv { display: grid; gap: var(--space-5); }
@media (min-width: 900px) { .pv { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px; align-items: start; } }
.pv-gallery { display: grid; gap: var(--space-3); }
@media (min-width: 900px) { .pv-gallery { position: sticky; top: 96px; } }
.pv-main { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); background: var(--color-surface); border: 1px solid var(--color-border); scrollbar-width: none; }
.pv-main::-webkit-scrollbar { display: none; }
.pv-main img { flex: 0 0 100%; width: 100%; aspect-ratio: var(--photo-ratio); object-fit: contain; scroll-snap-align: center; background: var(--color-surface); }
.pv-nophoto { aspect-ratio: var(--photo-ratio); width: 100%; display: grid; place-items: center; color: var(--color-text-subtle); }
.pv-thumbs { display: flex; gap: var(--space-2); overflow-x: auto; }
.pv-thumbs button { flex: none; width: 68px; height: 68px; padding: 0; border: 2px solid var(--color-border); border-radius: var(--radius); overflow: hidden; background: var(--color-surface); cursor: pointer; }
.pv-thumbs button[aria-current=true] { border-color: var(--color-primary); }
.pv-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pv-brand { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-subtle); margin-bottom: 4px; }
.pv-info h1 { font-family: var(--font-display); font-size: clamp(1.6rem, 1.25rem + 1.4vw, 2.4rem); font-weight: 700; line-height: 1.1; margin: 0; }
.pv-meta { margin: 8px 0 14px; }
.cond { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 600; }
.cond::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.cond-new { color: var(--color-success); }
.cond-used { color: var(--brand-orange-text); }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.price-now { font-family: var(--font-display); font-weight: 700; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.price-now.is-sale { color: #c2410c; }
.price-was { color: var(--color-text-subtle); font-size: .9em; }
.price-off { font-size: .78rem; font-weight: 700; background: var(--brand-orange); color: var(--brand-ink); padding: 2px 8px; border-radius: 4px; align-self: center; }
.pv-price { margin: 0 0 20px; }
.pv-price .price-now { font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.4rem); }
.pv-price .price-was { font-size: 1.05rem; }
.pv-contact { display: grid; gap: var(--space-2); }
.pv-contact .btn { min-height: 56px; font-size: 1.05rem; border-radius: 14px; }
.pv-contact-price { display: none; }
.pv-share { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 8px 2px; border: 0; background: none; font: inherit; font-size: .92rem; font-weight: 600; color: var(--color-text-muted); cursor: pointer; }
.pv-share svg { width: 18px; height: 18px; }
.pv-share:hover { color: var(--brand-blue); }
.pv-info-list { list-style: none; margin: 22px 0 0; padding: 14px 0 0; border-top: 1px solid var(--color-border); display: grid; gap: 10px; }
.pv-info-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--color-text-muted); }
.pv-info-list svg { width: 20px; height: 20px; color: var(--brand-blue); flex: none; }
.pv-desc { margin-top: 22px; padding-top: 24px; border-top: 1px solid var(--color-border); }
.pv-desc h2 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.pv-desc p { white-space: pre-line; color: var(--color-text); line-height: 1.65; margin: 0; }
