/* ============================================================
   Ki' Alimentos — main.css
   Paleta: rojo oscuro #8B1A1A, dorado #C9922A, crema #FDF6EC
   Tipografía: Playfair Display + DM Sans
   ============================================================ */

:root {
  --rojo:       #8B1A1A;
  --rojo-dark:  #6B1010;
  --rojo-light: #B22222;
  --dorado:     #C9922A;
  --dorado-light:#F0C060;
  --crema:      #FDF6EC;
  --crema-dark: #F5E8D0;
  --cafe:       #4A2C0A;
  --gris-text:  #3A3028;
  --gris-sub:   #7A6A5A;
  --gris-borde: #E8DDD0;
  --blanco:     #FFFFFF;
  --sombra-sm:  0 2px 8px rgba(0,0,0,0.08);
  --sombra-md:  0 4px 20px rgba(0,0,0,0.12);
  --sombra-lg:  0 8px 40px rgba(0,0,0,0.16);
  --radio:      10px;
  --radio-lg:   18px;
  --trans:      0.25s ease;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--crema);
  color: var(--gris-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.2;
  color: var(--cafe);
}

a { color: var(--rojo); text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--rojo-dark); }

img { max-width: 100%; display: block; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- BOTONES ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: var(--radio);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--trans);
  text-decoration: none;
  white-space: nowrap;
}
.btn--primary {
  background: var(--rojo);
  color: var(--blanco);
  border-color: var(--rojo);
}
.btn--primary:hover {
  background: var(--rojo-dark);
  border-color: var(--rojo-dark);
  color: var(--blanco);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(139,26,26,0.35);
}
.btn--outline {
  background: transparent;
  color: var(--rojo);
  border-color: var(--rojo);
}
.btn--outline:hover {
  background: var(--rojo);
  color: var(--blanco);
}
.btn--dorado {
  background: var(--dorado);
  color: var(--blanco);
  border-color: var(--dorado);
}
.btn--dorado:hover {
  background: #B07820;
  border-color: #B07820;
  color: var(--blanco);
}
.btn--lg { padding: 16px 36px; font-size: 1.05rem; }
.btn--sm { padding: 8px 16px; font-size: 0.85rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ---- NAVBAR ---- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(253,246,236,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gris-borde);
  transition: box-shadow var(--trans);
}
.navbar.scrolled { box-shadow: var(--sombra-md); }
.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}
.navbar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.navbar__brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cafe);
}
.navbar__brand em {
  color: var(--rojo);
  font-style: normal;
}
.navbar__links {
  display: flex;
  gap: 32px;
}
.navbar__links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--gris-text);
  position: relative;
}
.navbar__links a::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0; right: 100%;
  height: 2px;
  background: var(--rojo);
  transition: right var(--trans);
}
.navbar__links a:hover::after { right: 0; }
.navbar__links a:hover { color: var(--rojo); }

.navbar__actions { display: flex; align-items: center; gap: 12px; }

.navbar__search-btn,
.navbar__menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gris-text);
  padding: 6px;
  border-radius: 6px;
  transition: background var(--trans);
  display: flex;
  align-items: center;
}
.navbar__search-btn:hover,
.navbar__menu-btn:hover { background: var(--crema-dark); }

.navbar__menu-btn { display: none; flex-direction: column; gap: 4px; }
.navbar__menu-btn span {
  display: block;
  width: 22px; height: 2px;
  background: var(--gris-text);
  border-radius: 2px;
  transition: all var(--trans);
}

.carrito-toggle {
  position: relative;
  background: var(--rojo);
  border: none;
  color: var(--blanco);
  width: 42px; height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans);
}
.carrito-toggle:hover {
  background: var(--rojo-dark);
  transform: scale(1.05);
}
.carrito-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--dorado);
  color: var(--blanco);
  font-size: 0.7rem;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.navbar__mobile {
  display: none;
  flex-direction: column;
  padding: 16px 20px;
  border-top: 1px solid var(--gris-borde);
  background: var(--crema);
  gap: 4px;
}
.navbar__mobile a {
  padding: 10px 0;
  font-weight: 500;
  color: var(--gris-text);
  border-bottom: 1px solid var(--gris-borde);
}
.navbar__mobile.open { display: flex; }

/* ---- FLASH ---- */
.flash {
  position: fixed;
  top: 78px; left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  padding: 14px 24px;
  border-radius: var(--radio);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--sombra-lg);
  animation: slideDown 0.3s ease;
  max-width: 90vw;
}
.flash--success { background: #1a6b3a; color: white; }
.flash--error   { background: var(--rojo); color: white; }
.flash--info    { background: var(--dorado); color: white; }
.flash__close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  opacity: 0.7;
}
.flash__close:hover { opacity: 1; }

/* ---- SECCIÓN TÍTULOS ---- */
.section-title {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  color: var(--cafe);
  margin-bottom: 12px;
}
.section-title em {
  color: var(--rojo);
  font-style: normal;
}

/* ---- CARRITO SIDEBAR ---- */
.carrito-sidebar {
  position: fixed;
  top: 0; right: -420px;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--blanco);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sombra-lg);
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.carrito-sidebar.open { right: 0; }
.carrito-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: all var(--trans);
}
.carrito-overlay.active { opacity: 1; visibility: visible; }

.carrito-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gris-borde);
  background: var(--crema);
}
.carrito-sidebar__header h2 {
  font-size: 1.3rem;
  color: var(--cafe);
}
.carrito-sidebar__close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--gris-sub);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--trans);
}
.carrito-sidebar__close:hover {
  background: var(--crema-dark);
  color: var(--rojo);
}

.carrito-sidebar__items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.carrito-vacio {
  text-align: center;
  padding: 60px 20px;
  color: var(--gris-sub);
}
.carrito-vacio span { font-size: 3rem; display: block; margin-bottom: 12px; }
.carrito-vacio p { margin-bottom: 20px; }

.carrito-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gris-borde);
  animation: fadeIn 0.2s ease;
}
.carrito-item__img {
  width: 70px; height: 70px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--crema-dark);
  flex-shrink: 0;
}
.carrito-item__info { flex: 1; min-width: 0; }
.carrito-item__nombre {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.carrito-item__precio {
  font-size: 0.85rem;
  color: var(--gris-sub);
  margin: 2px 0;
}
.carrito-item__controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.qty-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--gris-borde);
  background: var(--crema);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans);
}
.qty-btn:hover { background: var(--rojo); color: white; border-color: var(--rojo); }
.qty-display {
  min-width: 28px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
}
.carrito-item__eliminar {
  background: none;
  border: none;
  color: var(--gris-sub);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  align-self: flex-start;
  transition: color var(--trans);
}
.carrito-item__eliminar:hover { color: var(--rojo); }

.carrito-sidebar__footer {
  padding: 20px 24px;
  border-top: 2px solid var(--gris-borde);
  background: var(--crema);
}
.carrito-totales { margin-bottom: 16px; }
.carrito-totales__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 4px 0;
  color: var(--gris-sub);
}
.carrito-totales__row--total {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--cafe);
  padding-top: 10px;
  margin-top: 6px;
  border-top: 1px solid var(--gris-borde);
}
.carrito-sidebar__secure {
  text-align: center;
  font-size: 0.78rem;
  color: var(--gris-sub);
  margin-top: 10px;
}

/* ---- INPUTS ---- */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--gris-text);
}
.form-group label .req { color: var(--rojo); }
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gris-borde);
  border-radius: var(--radio);
  background: var(--blanco);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--gris-text);
  transition: border-color var(--trans), box-shadow var(--trans);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--rojo);
  box-shadow: 0 0 0 3px rgba(139,26,26,0.12);
}
input.error { border-color: #e74c3c; }
.error-msg { font-size: 0.8rem; color: #e74c3c; margin-top: 4px; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1200;
  opacity: 0;
  visibility: hidden;
  transition: all var(--trans);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.producto-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 1300;
  background: var(--blanco);
  border-radius: var(--radio-lg);
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--sombra-lg);
}
.producto-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* ---- LOADING ---- */
.loading-spinner {
  text-align: center;
  padding: 60px 20px;
  color: var(--gris-sub);
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--gris-borde);
  border-top-color: var(--rojo);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

/* ---- ANIMACIONES ---- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateX(-50%) translateY(-12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ---- FOOTER ---- */
.footer {
  background: var(--cafe);
  color: rgba(255,255,255,0.8);
  padding: 60px 0 0;
  margin-top: 80px;
}
.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 40px;
  padding-bottom: 40px;
}
.footer__logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--blanco);
  display: block;
  margin-bottom: 12px;
}
.footer__logo em { color: var(--dorado-light); font-style: normal; }
.footer__brand p { font-size: 0.9rem; line-height: 1.7; }
.footer__social { display: flex; gap: 12px; margin-top: 16px; }
.footer__social a {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.8);
  transition: all var(--trans);
}
.footer__social a:hover { background: var(--dorado); color: white; }
.footer__links h4 {
  color: var(--dorado-light);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.footer__links ul { list-style: none; }
.footer__links li { margin-bottom: 8px; }
.footer__links a {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  transition: color var(--trans);
}
.footer__links a:hover { color: var(--dorado-light); }
.footer__contacto h4 {
  color: var(--dorado-light);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.footer__contacto p { font-size: 0.88rem; margin-bottom: 8px; }
.footer__contacto a { color: rgba(255,255,255,0.7); }
.footer__contacto a:hover { color: var(--dorado-light); }
.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 20px 0;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .navbar__links { display: none; }
  .navbar__menu-btn { display: flex; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .footer__grid { grid-template-columns: 1fr; }
  .carrito-sidebar { width: 100vw; right: -100vw; }
}

/* ---- BOTÓN FLOTANTE WHATSAPP ---- */
.wa-flotante {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #25D366;
  color: white;
  text-decoration: none;
  padding: 14px 20px 14px 16px;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(37,211,102,0.5);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  animation: wa-entrada 0.6s ease 1s both;
}
.wa-flotante:hover {
  background: #1da851;
  color: white;
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(37,211,102,0.6);
  text-decoration: none;
}
.wa-flotante svg {
  flex-shrink: 0;
}
.wa-flotante__texto {
  white-space: nowrap;
}

/* Anillo de pulso */
.wa-flotante__pulso {
  position: absolute;
  inset: 0;
  border-radius: 50px;
  border: 3px solid #25D366;
  animation: wa-pulso 2s ease-out infinite;
  pointer-events: none;
}

@keyframes wa-pulso {
  0%   { transform: scale(1); opacity: 0.8; }
  70%  { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}

@keyframes wa-entrada {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* En móvil: ocultar el texto para ahorrar espacio */
@media (max-width: 480px) {
  .wa-flotante {
    padding: 14px;
    border-radius: 50%;
    bottom: 20px;
    right: 20px;
  }
  .wa-flotante__texto { display: none; }
}
