/* =============================================
   LISTA DE COMPRAS — Leandrouno
   Tema claro/oscuro + diseño moderno
   (clases en español)
============================================= */

:root {
  --bg: #0b0f1a;
  --bg-radial: radial-gradient(circle at 50% -10%, #131b2e 0%, #0b0f1a 55%);
  --surface: #131a2a;
  --surface-2: #1a2236;
  --surface-3: #212b42;
  --border: #2a3450;
  --border-soft: #1e273c;
  --accent: #c9992f;
  --accent-bright: #e6b84f;
  --accent-dim: #7a5f22;
  --accent-ink: #17130a;
  --text: #eef1f8;
  --text-muted: #8b93ac;
  --text-faint: #545f7d;
  --success: #35d68e;
  --danger: #ef5757;
  --warning: #f0b429;
  --grid-opacity: 0.035;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-lift: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --font-display: 'Bebas Neue', sans-serif;
  --font-mono: 'Space Grotesk', 'Inter', monospace;
  --font-body: 'Inter', system-ui, sans-serif;
}

:root[data-theme="claro"] {
  --bg: #f3f4f8;
  --bg-radial: radial-gradient(circle at 50% -10%, #ffffff 0%, #f3f4f8 60%);
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #ebedf4;
  --border: #dde1eb;
  --border-soft: #e6e9f1;
  --accent: #b3801f;
  --accent-bright: #c9992f;
  --accent-dim: #8a6a24;
  --accent-ink: #ffffff;
  --text: #171b2b;
  --text-muted: #5c657e;
  --text-faint: #9098ac;
  --success: #17a874;
  --danger: #dd3f3f;
  --warning: #c9862a;
  --grid-opacity: 0.05;
  --shadow-lift: 0 16px 40px -22px rgba(30, 35, 60, 0.25);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg-radial), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
  transition: background 0.3s ease, color 0.3s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(201, 153, 47, var(--grid-opacity)) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 153, 47, var(--grid-opacity)) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at 50% 0%, black, transparent 70%);
  z-index: 0;
}

.contenedor-app {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto;
  padding: 36px 18px 0;
}

/* ---------- ENCABEZADO ---------- */
.encabezado-app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
}

.marca { display: flex; align-items: center; gap: 14px; }

.marca-icono {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dim));
  box-shadow: 0 8px 20px -6px rgba(201, 153, 47, 0.45);
  flex-shrink: 0;
}

.marca-texto h1 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 2.5px;
  margin: 0;
  line-height: 1;
  color: var(--text);
}

.marca-texto p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.boton-icono-encabezado {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.boton-icono-encabezado:hover { color: var(--accent-bright); border-color: var(--accent-dim); }

/* ---------- PANEL PRINCIPAL ---------- */
.panel-principal {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px 20px 24px;
  box-shadow: var(--shadow-lift);
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* ---------- PROGRESO ---------- */
.resumen-progreso {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.resumen-progreso .texto-progreso {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.resumen-progreso .texto-progreso strong { color: var(--accent-bright); }

.barra-progreso {
  flex: 1;
  height: 7px;
  border-radius: 6px;
  background: var(--surface-3);
  overflow: hidden;
}

.barra-progreso-relleno {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent-bright));
  transition: width 0.35s ease;
}

/* ---------- BUSCADOR ---------- */
.buscador-productos {
  position: relative;
  margin-bottom: 14px;
}

.buscador-productos i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 13px;
}

.buscador-productos input {
  width: 100%;
  padding: 10px 12px 10px 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
}

.buscador-productos input:focus { outline: none; border-color: var(--accent-dim); }

/* ---------- FORMULARIO AGREGAR ---------- */
.formulario-agregar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.formulario-agregar input[type="text"] {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
}

.formulario-agregar .campo-nombre { flex: 1; min-width: 0; }
.formulario-agregar .campo-cantidad { width: 78px; text-align: center; }

.formulario-agregar input:focus { outline: none; border-color: var(--accent-dim); }

/* ---------- BOTONES (compartidos) ---------- */
.boton {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.2px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.boton:active { transform: scale(0.97); }
.boton:disabled { opacity: 0.45; cursor: not-allowed; }

.boton-primario {
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dim));
  color: var(--accent-ink);
  box-shadow: 0 8px 18px -8px rgba(201, 153, 47, 0.5);
}

.boton-contorno {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.boton-contorno:hover { border-color: var(--accent-dim); color: var(--accent-bright); }

.boton-fantasma {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-soft);
  font-size: 12.5px;
  padding: 8px 14px;
}
.boton-fantasma:hover { border-color: var(--accent-dim); }

.boton-peligro-fantasma {
  background: transparent;
  color: var(--danger);
  border-color: rgba(239, 87, 87, 0.35);
  font-size: 12.5px;
  padding: 8px 14px;
}
.boton-peligro-fantasma:hover { background: rgba(239, 87, 87, 0.1); }

/* ---------- LISTA DE PRODUCTOS ---------- */
.lista-productos {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 2px;
}

.lista-productos::-webkit-scrollbar { width: 6px; }
.lista-productos::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; }

.producto {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.producto.comprado { opacity: 0.6; }

.producto-cabecera {
  display: flex;
  align-items: center;
  gap: 10px;
}

.casilla-producto {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  accent-color: var(--accent-bright);
  cursor: pointer;
}

.info-producto {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nombre-producto {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  cursor: text;
  border-bottom: 1px dashed transparent;
}

.nombre-producto:hover { border-bottom-color: var(--border); }

.producto.comprado .nombre-producto {
  text-decoration: line-through;
  color: var(--text-faint);
}

.input-editar-nombre {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  padding: 3px 7px;
  min-width: 80px;
}

.cantidad-producto {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-bright);
  background: rgba(201, 153, 47, 0.12);
  border: 1px solid rgba(201, 153, 47, 0.3);
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.acciones-producto {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.boton-icono {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border-soft);
  background: var(--surface-3);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.boton-icono:active { transform: scale(0.92); }
.boton-icono.eliminar:hover { background: var(--danger); color: #1a0808; border-color: var(--danger); }

.nota-producto {
  width: 100%;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12.5px;
}

.nota-producto:focus { outline: none; border-color: var(--accent-dim); color: var(--text); }

.estado-vacio {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 10px;
  color: var(--text-faint);
}

.estado-vacio.visible { display: flex; }
.estado-vacio i { font-size: 26px; opacity: 0.5; }
.estado-vacio p { margin: 0; font-size: 13px; }

/* ---------- ACCIONES DE LISTA ---------- */
.acciones-lista {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.acciones-lista .boton { flex: 1; justify-content: center; }

/* ---------- NOTA GENERAL ---------- */
.bloque-nota-general {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

.bloque-nota-general label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.bloque-nota-general textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  resize: vertical;
}

.bloque-nota-general textarea:focus { outline: none; border-color: var(--accent-dim); }

.indicador-guardado {
  font-size: 11px;
  color: var(--success);
  margin-top: 6px;
  height: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.indicador-guardado.visible { opacity: 1; }

/* ---------- MODAL DE CONFIGURACIÓN ---------- */
.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.6);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal-fondo.abierto { display: flex; }

.modal-caja {
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 20px;
}

.modal-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-cabecera h3 {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 1px;
  margin: 0;
  color: var(--text);
}

.fila-configuracion { margin-bottom: 16px; }
.fila-configuracion:last-child { margin-bottom: 0; }

.fila-configuracion label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.segmentado {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}

.boton-segmento {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12.5px;
  padding: 9px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.boton-segmento.activo {
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dim));
  color: var(--accent-ink);
}

.ayuda-configuracion {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 8px;
  line-height: 1.4;
}

/* ---------- PIE ---------- */
footer.pie-app {
  margin-top: 34px;
  padding: 22px 10px 10px;
  text-align: center;
  border-top: 1px solid var(--border-soft);
}

footer.pie-app .marca-pie {
  font-family: var(--font-display);
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
}
footer.pie-app .marca-pie:hover { color: var(--accent-bright); }

.social-pie { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }

.boton-social {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
  text-decoration: none;
}
.boton-social:hover { color: var(--accent-ink); background: var(--accent-bright); border-color: var(--accent-bright); }

/* ---------- MÓVIL ---------- */
@media (max-width: 480px) {
  .contenedor-app { padding: 22px 12px 0; }
  .marca-texto h1 { font-size: 24px; }
  .formulario-agregar .campo-cantidad { width: 64px; }
  .acciones-lista { flex-direction: column; }
}