/*
 * Estilos para necesito.com.ar
 * Diseñado para ser minimalista, funcional y agradable a la vista.
 */

/* Paleta de colores basada en las ilustraciones generadas */
:root {
  --bg: #f5efe6;           /* fondo general en tono crema */
  --card-bg: #ffffff;       /* tarjetas y contenedores */
  --primary: #f0b07a;       /* naranja pastel (botones principales) */
  --secondary: #86bcc7;     /* azul verdoso pastel (botones secundarios) */
  --accent: #e27f5f;        /* naranja más intenso para interacciones */
  --text: #3a2e2a;          /* color principal de texto */
  --border: #e3d8cd;        /* líneas divisorias sutiles */
  --radius: 12px;           /* radio de borde común */
  --shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

/* Ajustes generales */
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Hero/encabezado con ilustración */
.hero {
  position: relative;
  background-image: url('hero-groceries.png');
  background-size: cover;
  background-position: center;
  height: 40vh;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Capa semitransparente sobre la imagen para mejorar contraste */
.hero .overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.hero h1 {
  margin: 0;
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: lowercase;
  letter-spacing: -1px;
}

.hero p {
  margin-top: 0.5rem;
  font-size: 1.05rem;
  color: var(--text);
  max-width: 500px;
}

/* Contenedor principal */
.container {
  width: 90%;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-top: -3rem; /* ligeramente encima de la sección hero */
  z-index: 1;
}

/* Sección de entrada */
/* Sección de entrada: contiene campo de texto, selectores y botón */
.input-section {
  display: flex;
  align-items: stretch;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Todos los hijos directos heredan bordes divisores */
.input-section > * {
  border: none;
  background-color: #faf8f6;
  font-size: 0.9rem;
}
.input-section > * + * {
  border-left: 1px solid var(--border);
}

.input-section input {
  flex: 4;
  padding: 0.75rem 1rem;
  color: var(--text);
  outline: none;
  font-size: 1rem;
  background-color: transparent;
}

.input-section select {
  flex: 2;
  min-width: 100px;
  padding: 0.75rem 0.5rem;
  color: var(--text);
  background-color: transparent;
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.input-section button {
  flex: 1.5;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  padding: 0 1rem;
}
.input-section button:hover {
  background: var(--accent);
}

/* Lista de compras */
.shopping-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 40vh;
  overflow-y: auto;
}

.shopping-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

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

/* Cabecera de categoría */
.category-header {
  margin-top: 1rem;
  padding: 0.5rem 0;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.category-header img {
  width: 24px;
  height: 24px;
}
.category-header span {
  font-size: 1.1rem;
}

/* Fila de artículo */
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.item-row:last-child {
  border-bottom: none;
}
.item-row .left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1;
}
.item-row .left img.category-icon {
  width: 24px;
  height: 24px;
}
.item-row .left .item-text {
  flex: 1;
  font-size: 1.05rem;
  cursor: pointer;
  word-break: break-word;
}
.item-row .left .item-text.done {
  text-decoration: line-through;
  opacity: 0.6;
}

.item-row .right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Etiqueta de urgencia */
.urgency {
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  color: #fff;
  text-transform: uppercase;
}
.urgency-high {
  background: #d9534f;
}
.urgency-medium {
  background: #f0ad4e;
}
.urgency-low {
  background: #5cb85c;
}

/* Botones de acciones de cada ítem */
.item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.item-actions button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.2rem;
  transition: color 0.2s ease;
}
.item-actions button.toggle {
  color: var(--secondary);
}
.item-actions button.toggle.done {
  color: var(--accent);
}
.item-actions button.delete {
  color: #c66c5b;
}
.item-actions button:hover {
  opacity: 0.8;
}

/* Botones de acciones globales */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.actions button {
  flex: 1;
  min-width: 30%;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  color: #fff;
  transition: background 0.2s ease;
}

#copy-button {
  background: var(--secondary);
}
#copy-button:hover {
  background: #6ea2af;
}

#whatsapp-button {
  background: #25d366; /* color clásico de WhatsApp */
}
#whatsapp-button:hover {
  background: #1ea654;
}

#clear-button {
  background: var(--accent);
}
#clear-button:hover {
  background: #c96a53;
}

/* Pie de página */
footer {
  margin-top: auto;
  padding: 2rem 0 1rem 0;
  text-align: center;
  font-size: 0.9rem;
  color: #6c5e58;
}

.cafecito img {
  width: 180px;
  max-width: 80%;
}

.credits {
  margin-top: 0.8rem;
  color: #887a71;
}

/* Scrollbar suave para la lista */
.shopping-list::-webkit-scrollbar {
  width: 6px;
}
.shopping-list::-webkit-scrollbar-track {
  background: transparent;
}
.shopping-list::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .hero h1 {
    font-size: 2.2rem;
  }
  .hero p {
    font-size: 0.95rem;
  }
  .container {
    padding: 1.5rem;
    margin-top: -2.5rem;
  }
  .actions button {
    font-size: 0.9rem;
    padding: 0.55rem;
  }
}

/* Botón de cambio de tema */
.theme-toggle {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--accent);
  transition: transform 0.3s ease;
}
.theme-toggle:hover {
  transform: rotate(20deg);
}

/* Variables para modo oscuro */
body.dark {
  --bg: #1e1e1e;
  --card-bg: #2b2b2b;
  --primary: #c3945c;
  --secondary: #5fa5b2;
  --accent: #ce7c5a;
  --text: #e8e6e3;
  --border: #444;
}

body.dark .hero .overlay {
  background: rgba(30, 30, 30, 0.8);
}
body.dark footer {
  color: #b3ada8;
}
body.dark .credits {
  color: #8d867f;
}