/* ==========================================
   HOJA DE ESTILOS PRINCIPAL (styles.css)
   ========================================== */

/* --- 1. IMPORTACIÓN DE ARCHIVOS CSS MODULARES --- */
@import url('inicio.css');
@import url('catalogo.css');
@import url('detalle.css');

/* --- 2. VARIABLES GLOBALES (Custom Properties para Dark Mode) --- */
:root {
  /* Layout & Spacing */
  --header-offset: 80px;

  /* Colores Principales (Light Mode por defecto) */
  --bg-main: #ffffff;
  --bg-secondary: #f1ede4;
  --bg-secondary-hover: #dbd9d1;
  --bg-card: #ffffff;
  --bg-card-img: #faf9f6;
  --bg-sidebar: #ffffff;

  /* Colores de Texto */
  --text-primary: #1a1a1a;
  --text-secondary: #1b2127;
  --text-muted: #666666;
  --text-light: #ffffff;

  /* Botones y Elementos Interactivos */
  --btn-primary-bg: #1a1a1a;
  --btn-primary-text: #ffffff;
  --btn-primary-hover: #1b2127;

  /* Bordes */
  --border-color: #eaeaea;
  --border-color-hover: #dcdcdc;
  --border-color-strong: #1a1a1a;
  --border-color-subtle: #eeeeee;

  /* Sombras */
  --shadow-card-hover: 0 12px 24px rgba(0, 0, 0, 0.08);

  /* Badges / Etiquetas */
  --tag-sintacc-bg: #ffebee;
  --tag-sintacc-border: #ffcdd2;
  --tag-sintacc-text: #c62828;

  --tag-sinazucar-bg: #e3f2fd;
  --tag-sinazucar-border: #bbdefb;
  --tag-sinazucar-text: #1565c0;

  --tag-vegano-bg: #e8f5e9;
  --tag-vegano-border: #c8e6c9;
  --tag-vegano-text: #2e7d32;
}

/* --- MODO OSCURO (DARK MODE) --- */
body.dark-mode {
  --bg-main: #121212;
  --bg-secondary: #1d1f21;
  --bg-secondary-hover: #2c2f33;
  --bg-card: #1d1f21;
  --bg-card-img: #25282c;
  --bg-sidebar: #1d1f21;

  --text-primary: #f0f0f0;
  --text-secondary: #d0d0d0;
  --text-muted: #a0a0a0;
  --text-light: #ffffff;

  --btn-primary-bg: #f1ede4;
  --btn-primary-text: #1a1a1a;
  --btn-primary-hover: #ffffff;

  --border-color: #33363a;
  --border-color-hover: #4a4d52;
  --border-color-strong: #666666;
  --border-color-subtle: #2d3035;

  --shadow-card-hover: 0 12px 24px rgba(0, 0, 0, 0.35);

  --tag-sintacc-bg: #3b191c;
  --tag-sintacc-border: #5c2328;
  --tag-sintacc-text: #ff8a80;

  --tag-sinazucar-bg: #152938;
  --tag-sinazucar-border: #1e3d54;
  --tag-sinazucar-text: #82b1ff;

  --tag-vegano-bg: #1a331e;
  --tag-vegano-border: #274c2d;
  --tag-vegano-text: #b9f6ca;
}



/* --- 3. CONFIGURACIÓN GLOBAL & RESETS --- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  color: var(--text-primary);
  transition: background-color 0.25s ease, color 0.25s ease;
}

main {
  flex: 1;
}

ul {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
}

body h2 {
  font-size: 40px;
  margin: 30px 0px 60px;
  font-family: "Roboto Slab", serif;
  color: var(--text-primary);
}

/* --- 4. ENCABEZADO Y MENÚ DE NAVEGACIÓN COMPARTIDO --- */
.encabezado {
  background-color: var(--bg-secondary);
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: background-color 0.25s ease;
}

.encabezado-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-principal {
  width: 150px;
}

.logo-principal img {
  width: 100%;
  display: block;
}

.menu ul {
  list-style: none;
  display: flex;
}

.menu li {
  padding: 10px 0px;
  font-family: "Roboto", sans-serif;
  font-weight: 450;
  transition: background-color 0.1s;
  border-radius: 10px;
  margin-inline: 2px;
}

.menu li:hover {
  background-color: var(--bg-secondary-hover);
}

.menu a {
  color: var(--text-primary);
  text-decoration: none;
  padding: 10px 15px;
}

/* --- BOTÓN DE MODO OSCURO (INTERRUPTOR HORIZONTAL CON SOL Y LUNA) --- */
.btn-dark-mode {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  user-select: none;
  outline: none;
}

.toggle-track {
  width: 54px;
  height: 28px;
  background-color: #e2ded5;
  border-radius: 30px;
  position: relative;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  border: 2px solid #d4cebe;
  transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.icon-sun,
.icon-moon {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -6.5px;
  margin-left: -6.5px;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), color 0.5s ease;
}

.icon-sun {
  color: #f57c00;
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.icon-moon {
  color: #fbc02d;
  opacity: 0;
  transform: scale(0.4) rotate(-90deg);
}

/* Estado Modo Oscuro (Dark Mode) */
body.dark-mode .toggle-track {
  background-color: #2a2d32;
  border-color: #40444a;
}

body.dark-mode .toggle-thumb {
  transform: translateX(26px);
  background-color: #1e2023;
}

body.dark-mode .icon-sun {
  opacity: 0;
  transform: scale(0.4) rotate(90deg);
}

body.dark-mode .icon-moon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.btn-dark-mode:hover .toggle-track {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 0 6px rgba(0, 0, 0, 0.12);
}

/* --- 5. PIE DE PÁGINA (FOOTER) COMPARTIDO --- */
#pie-pagina {
  scroll-margin-top: var(--header-offset);
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  background-color: var(--bg-secondary);
  padding: 40px 80px;
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  transition: background-color 0.25s ease;
}

.footer-inner {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.menu-footer a {
  text-decoration: none;
  color: var(--text-secondary);
}

.menu-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contactos ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}

.item-footer img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  margin: 0;
}

.item-footer a {
  text-decoration: none;
  color: var(--text-secondary);
  margin-top: 5px;
  font-weight: 350;
}

.item-footer a:hover {
  text-decoration: underline;
}

.logo-footer {
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
}

.logo-footer p {
  margin: 0;
  font-family: "Roboto", sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
}

.logo-footer img {
  width: 50px;
  margin: 10px;
}

@media (max-width: 720px) {
  .footer-inner {
    flex-direction: column;
  }
}

/* --- 6. COMPONENTES COMPARTIDOS: TARJETAS DE PRODUCTO Y BADGES --- */
.grilla-productos {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 200px);
  justify-content: center;
  gap: 20px;
}

@media (max-width: 1140px) {
  .grilla-productos {
    grid-template-columns: repeat(2, 200px);
  }
}

@media (max-width: 480px) {
  .grilla-productos {
    grid-template-columns: repeat(1, minmax(200px, 300px));
  }
}

.producto-card {
  background-color: var(--bg-card);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
  text-align: left;
}

.producto-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-color-hover);
}

.producto-imagen-wrapper {
  background-color: var(--bg-card-img);
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.25s ease;
}

.producto-imagen-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.producto-card:hover .producto-imagen-wrapper img {
  transform: scale(1.07);
}

.producto-detalles {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
  gap: 12px;
}

.producto-titulo {
  font-family: "Roboto", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.35;
}

.producto-descripcion {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.producto-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
}

.producto-precio {
  font-family: "Roboto Slab", serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.producto-btn {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-family: "Roboto", sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.producto-card:hover .producto-btn {
  background-color: var(--btn-primary-hover);
}

.mensaje-cargando {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 20px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 60px 20px;
  margin: 0;
  font-family: "Roboto", sans-serif;
}

/* Badges / Etiquetas */
.producto-tags-container {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  z-index: 10;
}

.tag-badge {
  padding: 3px 7px;
  border-radius: 6px;
  font-family: "Roboto", sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.tag-sintacc {
  background-color: var(--tag-sintacc-bg);
  border: 1px solid var(--tag-sintacc-border);
  color: var(--tag-sintacc-text);
}

.tag-sinazucar {
  background-color: var(--tag-sinazucar-bg);
  border: 1px solid var(--tag-sinazucar-border);
  color: var(--tag-sinazucar-text);
}

.tag-vegano {
  background-color: var(--tag-vegano-bg);
  border: 1px solid var(--tag-vegano-border);
  color: var(--tag-vegano-text);
}