/* ═══════════════════════════════════════════════════════════════════════
   Panel Catálogo · La Tahona de Carmen
   Estética de marca (morado / dorado / crema), pensada mobile-first.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --purple: #6B2D7C;
  --purple-dark: #4A1F58;
  --purple-light: #8B4A9C;
  --gold: #C9A961;
  --gold-light: #E0BC55;
  --cream: #FAF6EF;
  --cream-dark: #F2EADC;
  --text: #2D1A33;
  --muted: #7A5B85;
  --line: #DCC9D8;
  --ok: #2E7D52;
  --ok-soft: #E3F3EA;
  --bad: #C44545;
  --bad-soft: #FBE5E5;
  --warn: #B8860B;
  --warn-soft: #FBF3DC;
  --shadow: 0 2px 10px rgba(107, 45, 124, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: 40px;
}

/* ───────── Cabecera y navegación ───────── */

header.top {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
  color: #fff;
  padding: 14px 16px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.top-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.marca {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.marca .fruta { font-size: 20px; }
.salir {
  color: var(--gold-light);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,.35);
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
.salir:active { background: rgba(255,255,255,.15); }

nav.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: 13.5px;
  padding: 9px 13px;
  border-radius: 8px 8px 0 0;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
nav.tabs a.activo {
  color: #fff;
  font-weight: 600;
  background: rgba(255,255,255,.12);
  border-bottom-color: var(--gold-light);
}

/* ───────── Contenedor ───────── */

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}
h1.pagina {
  font-size: 22px;
  color: var(--purple-dark);
  margin-bottom: 4px;
}
.subtitulo {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}

/* ───────── Tarjetas ───────── */

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 16px;
  color: var(--purple-dark);
  margin-bottom: 10px;
}

/* ───────── Botones ───────── */

button, .boton {
  font-family: inherit;
  font-size: 15px;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  background: var(--purple);
  color: #fff;
  font-weight: 600;
  transition: transform .05s, background .15s;
}
button:active, .boton:active { transform: scale(.98); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.secundario { background: var(--cream-dark); color: var(--purple-dark); }
button.peligro { background: var(--bad); }
button.exito { background: var(--ok); }
button.pequeno { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

.boton-grande {
  width: 100%;
  font-size: 18px;
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: var(--purple-dark);
  box-shadow: 0 4px 14px rgba(201,169,97,.4);
}

/* ───────── Formularios ───────── */

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 4px;
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px; /* 16px evita el zoom automático en iOS */
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(139,74,156,.15);
}
textarea { min-height: 220px; resize: vertical; line-height: 1.5; }
.fila { display: flex; gap: 10px; flex-wrap: wrap; }
.fila > * { flex: 1; min-width: 0; }
.fila-botones { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ───────── Consola de progreso ───────── */

.consola {
  background: #2D1A33;
  color: #E8DCEF;
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 14px;
  border-radius: 10px;
  height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.consola .ok { color: #8DE0AE; }
.consola .err { color: #FF9E9E; }
.consola .head { color: var(--gold-light); font-weight: 700; }

/* ───────── Listas / filas ───────── */

.lista { list-style: none; }
.lista li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}
.lista li:last-child { border-bottom: none; }
.lista .nombre { flex: 1; word-break: break-word; }
.contador { color: var(--muted); font-size: 13px; }

/* Etiquetas de cambio (comparativa) */
.tag { font-size: 12px; padding: 2px 8px; border-radius: 20px; font-weight: 700; white-space: nowrap; }
.tag.baja { background: var(--ok-soft); color: var(--ok); }
.tag.sube { background: var(--bad-soft); color: var(--bad); }
.tag.nuevo { background: var(--warn-soft); color: var(--warn); }
.tag.verano { background: #FFF1D6; color: #B8860B; }

.precio-tachado { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.precio-nuevo { font-weight: 700; color: var(--purple-dark); }

/* ───────── Avisos / banners ───────── */

.aviso {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 14px;
  border-left: 4px solid var(--purple);
  background: #fff;
}
.aviso.info { border-color: var(--purple); }
.aviso.exito { border-color: var(--ok); background: var(--ok-soft); }
.aviso.error { border-color: var(--bad); background: var(--bad-soft); }
.aviso.vacio { color: var(--muted); text-align: center; border-color: var(--line); }

.pista {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
  background: var(--cream-dark);
  padding: 8px 10px;
  border-radius: 8px;
}
.pista strong { color: var(--purple-dark); }

/* ───────── Toast ───────── */

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(60px);
  background: var(--purple-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  opacity: 0;
  transition: all .25s;
  z-index: 100;
  max-width: 90%;
  text-align: center;
}
#toast.ver { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.error { background: var(--bad); }
#toast.exito { background: var(--ok); }

/* ───────── Login ───────── */

.login-wrap {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 26px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card .logo { font-size: 40px; }
.login-card h1 { font-size: 20px; color: var(--purple-dark); margin: 8px 0 4px; }
.login-card p { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

/* ───────── Utilidades ───────── */

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gira .7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes gira { to { transform: rotate(360deg); } }
.oculto { display: none !important; }
.mt { margin-top: 14px; }
.centro { text-align: center; }

@media (min-width: 600px) {
  h1.pagina { font-size: 26px; }
}
