/* ==========================================================================
   TIENDA PALPAN — SISTEMA DE DISEÑO Y ESTILOS PRINCIPALES
   Supermercado Online Moderno, Limpio, Comercial y Confiable
   ========================================================================== */

/* --- RESET & VARIABLES GLOBALES --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Paleta Principal Supermercado Palpan */
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #10b981;
  --primary-subtle: #ecfdf5;
  --primary-border: #a7f3d0;

  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-light: #fbbf24;
  --accent-subtle: #fffbeb;

  --teal: #0d9488;
  --teal-dark: #0f766e;

  /* Estados de Stock & Alertas */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #6ee7b7;

  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  /* Escala de Grises & Textos (Alto Contraste WCAG) */
  --gray-950: #090d16;
  --gray-900: #0f172a;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;
  --white: #ffffff;

  /* Sombras y Elevaciones */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  /* Bordes Redondeados */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Tipografía y Transición */
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Clases de utilidad */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.main {
  flex: 1;
  padding: 1.5rem 0 3.5rem;
}

/* ==========================================================================
   CABECERA PRINCIPAL (HEADER)
   ========================================================================== */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.85rem 1.25rem;
  flex-wrap: wrap;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: var(--transition);
}

.logo:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.logo-img {
  height: 42px;
  width: auto;
  display: block;
}

/* Buscador Central Prominente */
.search-form {
  flex: 1;
  max-width: 580px;
  min-width: 260px;
  position: relative;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  position: relative;
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-full);
  transition: var(--transition);
  padding: 2px;
}

.search-input-wrap:focus-within {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.12);
}

.search-icon-deco {
  padding-left: 0.85rem;
  font-size: 1rem;
  color: var(--gray-400);
  user-select: none;
}

.search-form input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  color: var(--gray-900);
  outline: none;
  font-family: inherit;
}

.search-form input::placeholder {
  color: var(--gray-400);
}

.btn-search {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-search:hover {
  background: var(--primary-dark);
}

/* Sugerencias de Búsqueda */
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  max-height: 320px;
  overflow-y: auto;
}

/* Botones de Cabecera (Cuenta, Admin, Carrito) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.btn-header {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-700);
}

.btn-header:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  border-color: var(--gray-300);
}

.btn-auth {
  background: var(--primary-subtle);
  border-color: var(--primary-border);
  color: var(--primary-dark);
}

.btn-auth:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.btn-cart {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--white);
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
  position: relative;
}

.btn-cart:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
  transform: translateY(-1px);
}

.cart-icon {
  font-size: 1.15rem;
}

.cart-count {
  background: var(--accent);
  color: var(--gray-900);
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--primary);
}

/* ==========================================================================
   BARRA DE CATEGORÍAS (ALTO CONTRASTE WCAG & SCROLL SUAVE)
   ========================================================================== */
.navbar {
  background: var(--white);
  border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}

.categories-list {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  overflow-x: auto;
  padding: 0.6rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
  -webkit-overflow-scrolling: touch;
}

.categories-list::-webkit-scrollbar {
  height: 4px;
}

.categories-list::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

.cat-link {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  color: var(--gray-700);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.cat-link:hover {
  background: var(--primary-subtle);
  color: var(--primary-dark);
  border-color: var(--primary-border);
  transform: translateY(-1px);
}

.cat-link.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary-dark);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.22);
}

.cat-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ==========================================================================
   HERO BANNER
   ========================================================================== */
.hero {
  background: linear-gradient(135deg, #047857 0%, #059669 45%, #0d9488 100%);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.75rem 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.hero::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  max-width: 780px;
  position: relative;
  z-index: 2;
}

.hero-kicker {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.hero h1 {
  font-size: 2.15rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.85rem;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 1.05rem;
  opacity: 0.95;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.btn-hero {
  background: var(--accent);
  color: var(--gray-900);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-full);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-hero:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.4);
}

.hero-features {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-feature-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.92;
}

.feature-icon {
  background: rgba(255, 255, 255, 0.2);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

/* ==========================================================================
   FILTROS Y BARRA DE CONTROL DEL CATÁLOGO
   ========================================================================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--white);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
}

.section-title-wrap h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}

.catalog-meta {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 0.2rem;
  font-weight: 500;
}

.catalog-filters {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.filter-group-price {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.catalog-filters input[type="number"] {
  width: 90px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.85rem;
  color: var(--gray-800);
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

.catalog-filters input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-border);
}

.price-sep {
  color: var(--gray-400);
  font-weight: 600;
}

.catalog-filters select {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

.catalog-filters select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-border);
}

.btn-clear-filters {
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear-filters:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

/* ==========================================================================
   GRID DE PRODUCTOS Y TARJETAS (CARDS)
   ========================================================================== */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.product-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  position: relative;
}

.product-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

/* Envoltura de imagen */
.product-image-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: none;
  background: var(--gray-50);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  transition: var(--transition);
}

.product-image-wrap:hover img {
  transform: scale(1.05);
}

.product-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

/* Información del producto */
.product-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--teal-dark);
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.product-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.35;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.product-price {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gray-950);
  margin-bottom: 0.4rem;
}

/* Badges de Stock */
.product-stock {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  width: fit-content;
  margin-bottom: 0.85rem;
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid var(--success-border);
}

.product-stock.low-stock {
  background: var(--warning-bg);
  color: #92400e;
  border-color: var(--warning-border);
}

.product-stock.out-of-stock {
  background: var(--danger-bg);
  color: #991b1b;
  border-color: var(--danger-border);
}

/* Botón Agregar al Carrito */
.btn-add-cart {
  width: 100%;
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: auto;
}

.btn-add-cart:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-add-cart:disabled {
  background: var(--gray-200);
  color: var(--gray-500);
  cursor: not-allowed;
}

/* Paginación */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  align-items: center;
  padding: 2.5rem 0 1rem;
}

.pagination span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-600);
}

/* ==========================================================================
   MODALES Y FORMULARIOS
   ========================================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none !important;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  padding: 1.75rem;
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content.modal-cart {
  max-width: 580px;
}

.modal-content.modal-auth {
  max-width: 440px;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--gray-100);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.25rem;
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.modal-header-box h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 0.35rem;
}

/* Formulario */
.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.address-actions { display:flex; gap:.6rem; flex-wrap:wrap; margin-top:.6rem; }
.app-loading { position:fixed;inset:0;z-index:9999;background:rgba(255,255,255,.96);display:grid;place-content:center;text-align:center;gap:.8rem;transition:opacity .2s ease; }
.app-loading[hidden] { display:none; }.app-loading img{width:170px;margin:auto}.loading-spinner{width:34px;height:34px;border:3px solid #d1fae5;border-top-color:#059669;border-radius:50%;animation:palpan-spin .7s linear infinite;margin:auto}@keyframes palpan-spin{to{transform:rotate(360deg)}}
.loading,.loading-row { position:relative;overflow:hidden;background:#f1f5f9;border-radius:10px;padding:1rem;color:#475569; }.loading::after,.loading-row::after{content:"";position:absolute;inset:0;transform:translateX(-100%);background:linear-gradient(90deg,transparent,rgba(255,255,255,.8),transparent);animation:palpan-shimmer 1.2s infinite}@keyframes palpan-shimmer{to{transform:translateX(100%)}}
.delivery-quote { margin-top:.75rem; padding:.85rem; border-radius:10px; background:#f1f5f9; color:#334155; }
.delivery-quote:empty { display:none; }
.normalized-address { display:block;font-size:1.05rem;font-weight:800;color:#0f172a;margin:.45rem 0; }
.quote-metrics { display:grid;grid-template-columns:repeat(3,1fr);gap:.45rem;margin:.65rem 0; }
.quote-metrics span { background:#fff;border:1px solid #dbeafe;border-radius:9px;padding:.55rem;text-align:center;font-weight:700; }
.address-warning { color:#92400e;background:#fffbeb;padding:.6rem;border-radius:8px; }
.order-progress { display:flex; gap:.3rem; flex-wrap:wrap; margin-top:.65rem; }
.order-step { padding:.25rem .45rem; border-radius:999px; background:#e2e8f0; font-size:.72rem; }
.order-step.done { background:#d1fae5; color:#065f46; font-weight:700; }
@media (max-width:600px) { .quote-metrics { grid-template-columns:1fr; } .address-actions button { width:100%; } }
[hidden] { display:none !important; }

.modal-content.modal-account { max-width:860px; padding:2rem; }
.account-intro { color:var(--gray-600); margin:.2rem 0 1.4rem; }
.account-subtitle { margin:1.2rem 0 .65rem; color:var(--gray-900); font-size:1rem; text-transform:uppercase; letter-spacing:.06em; }
.profile-data-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.75rem; margin:0; }
.profile-data-grid div { border:1px solid var(--gray-200); background:var(--gray-50); border-radius:12px; padding:.8rem 1rem; min-width:0; }
.profile-data-grid dt,.profile-order-detail dt { color:var(--gray-500); font-size:.72rem; font-weight:800; text-transform:uppercase; letter-spacing:.05em; }
.profile-data-grid dd,.profile-order-detail dd { margin:.2rem 0 0; color:var(--gray-900); font-weight:700; overflow-wrap:anywhere; }
.profile-order-list { display:grid; gap:1rem; margin-top:.6rem; }
.profile-order-card { border:1px solid var(--gray-200); border-radius:16px; padding:1rem; background:#fff; box-shadow:0 8px 24px rgba(15,23,42,.05); }
.profile-order-card header { display:flex; justify-content:space-between; gap:1rem; align-items:flex-start; }
.profile-order-card header div { display:grid; gap:.15rem; }
.order-number { font-weight:850; color:var(--gray-900); }
.profile-order-card time,.order-summary { color:var(--gray-500); font-size:.82rem; }
.order-total { color:var(--primary); white-space:nowrap; }
.order-summary { margin:.65rem 0; }
.order-tracker { list-style:none; display:grid; grid-template-columns:repeat(6,1fr); padding:0; margin:1rem 0; gap:0; }
.order-tracker li { position:relative; display:grid; justify-items:center; text-align:center; gap:.35rem; color:var(--gray-400); font-size:.68rem; font-weight:700; }
.order-tracker li:not(:last-child)::after { content:""; position:absolute; height:3px; background:var(--gray-200); left:calc(50% + 13px); right:calc(-50% + 13px); top:11px; }
.order-tracker li.completed::after { background:#34a853; }
.tracker-dot { width:25px; height:25px; border-radius:50%; background:var(--gray-200); display:grid; place-items:center; z-index:1; }
.order-tracker .completed,.order-tracker .current { color:#166534; }
.order-tracker .completed .tracker-dot { background:#34a853; color:#fff; }
.order-tracker .current .tracker-dot { background:#fff; border:3px solid:#34a853; color:#166534; }
.order-cancelled { border-left:4px solid #dc2626; color:#991b1b; background:#fef2f2; border-radius:8px; padding:.65rem .8rem; font-weight:800; margin:.8rem 0; }
.profile-order-actions { display:flex; gap:.6rem; flex-wrap:wrap; }
.profile-order-actions .btn-secondary { padding:.55rem .8rem; text-decoration:none; }
.profile-order-detail { margin-top:.9rem; border-top:1px solid var(--gray-200); padding-top:.8rem; }
.profile-order-detail ul { list-style:none; padding:0; margin:0 0 .8rem; display:grid; gap:.4rem; }
.profile-order-detail li { display:flex; justify-content:space-between; gap:1rem; font-size:.84rem; }
.profile-order-detail dl { display:grid; grid-template-columns:2fr 1fr 1fr; gap:.6rem; margin:0; }
.empty-orders,.profile-error { padding:1.5rem; text-align:center; color:var(--gray-500); background:var(--gray-50); border-radius:12px; }
.profile-error { color:#b91c1c; }
@media (max-width:700px) {
  .modal-content.modal-account { padding:1.2rem; border-radius:16px 16px 0 0; max-height:94vh; align-self:end; }
  .profile-data-grid { grid-template-columns:1fr; }
  .order-tracker { grid-template-columns:1fr; gap:.4rem; }
  .order-tracker li { grid-template-columns:28px 1fr; justify-items:start; text-align:left; align-items:center; }
  .order-tracker li:not(:last-child)::after { width:3px; height:calc(100% + .4rem); left:11px; right:auto; top:24px; }
  .profile-order-detail dl { grid-template-columns:1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-700);
}

.form-group input, .form-group textarea {
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--gray-900);
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

/* Botones Base */
.btn-primary {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-primary.btn-block {
  width: 100%;
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.link-button {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
}

/* Items del Carrito */
.cart-items {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.cart-item-img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  background: var(--white);
  border-radius: var(--radius-xs);
  padding: 3px;
}

.cart-item-info {
  flex: 1;
}

.cart-item-info b {
  display: block;
  font-size: 0.9rem;
  color: var(--gray-900);
}

.cart-item-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.qty-btn {
  width: 26px;
  height: 26px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
}

.cart-footer {
  border-top: 1px solid var(--gray-200);
  padding-top: 1rem;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.cart-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.cart-actions button {
  flex: 1;
}

/* ==========================================================================
   WIDGET DEL CHAT: ASISTENTE PALPAN
   ========================================================================== */
.chat-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1500;
}

.chat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--teal) 100%);
  color: var(--white);
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.4);
  transition: var(--transition);
}

.chat-toggle:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.5);
}

.chat-toggle-icon {
  font-size: 1.2rem;
}

.chat-window {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 380px;
  max-width: calc(100vw - 3rem);
  height: 520px;
  max-height: calc(100vh - 7rem);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1600;
}

.chat-window[hidden] {
  display: none !important;
}

/* Header del Chat */
.chat-header {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  color: var(--white);
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.chat-header strong {
  font-size: 0.95rem;
  display: block;
}

.chat-status-text {
  font-size: 0.75rem;
  opacity: 0.9;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.status-dot-mini {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}

.chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--white);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Mensajes */
.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f8fafc;
}

.chat-msg {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  font-size: 0.88rem;
  line-height: 1.45;
  border-radius: var(--radius);
  word-break: break-word;
  position: relative;
}

.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary) 0%, var(--teal) 100%);
  color: var(--white);
  border-bottom-right-radius: 2px;
}

.chat-msg.bot {
  align-self: flex-start;
  background: var(--white);
  color: var(--gray-900);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
  border-bottom-left-radius: 2px;
  white-space: pre-line;
}

.chat-time {
  font-size: 0.68rem;
  opacity: 0.75;
  display: block;
  text-align: right;
  margin-top: 0.25rem;
}

/* Indicador de Escritura (Typing Dots) */
.chat-msg.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.75rem 1rem;
}

.chat-msg.typing-indicator .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.chat-msg.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.chat-msg.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input Form del Chat */
.chat-input-form {
  display: flex;
  padding: 0.65rem;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  gap: 0.5rem;
}

.chat-input-form input {
  flex: 1;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-full);
  padding: 0.55rem 0.95rem;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

.chat-input-form input:focus {
  border-color: var(--primary);
}

.chat-send {
  background: var(--primary);
  color: var(--white);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.chat-send:hover:not(:disabled) {
  background: var(--primary-dark);
}

.chat-send:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: var(--white);
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  transition: opacity 0.2s;
}

.toast.success { background: #065f46; border: 1px solid var(--primary-border); }
.toast.error { background: #991b1b; border: 1px solid var(--danger-border); }





/* Footer */
.footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 3rem 0 1.5rem;
  margin-top: auto;
  border-top: 1px solid var(--gray-800);
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.footer-brand p {
  max-width: 500px;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.footer-info h3 {
  color: var(--white);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.footer-info p {
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
}

.footer-bottom {
  border-top: 1px solid var(--gray-800);
  padding-top: 1.5rem;
  font-size: 0.82rem;
  text-align: center;
}

/* ==========================================================================
   ADAPTABILIDAD RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .search-form {
    max-width: 100%;
    order: 3;
  }
  .header-actions {
    justify-content: space-between;
    width: 100%;
  }
  .hero {
    padding: 2rem 1.25rem;
  }
  .hero h1 {
    font-size: 1.6rem;
  }
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
  .catalog-filters {
    width: 100%;
    justify-content: space-between;
  }
  .chat-window {
    right: 1rem;
    left: 1rem;
    width: auto;
    bottom: 5rem;
    height: 70vh;
  }
}

@media (max-width: 390px) {
  .productos-grid {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    font-size: 1.4rem;
  }
  .catalog-filters select, .catalog-filters input[type="number"] {
    width: 100%;
  }
}

.checkout-map svg { display:block; width:100%; height:auto; margin-top:.75rem; }
.footer-location { color:inherit; text-decoration:none; overflow-wrap:anywhere; transition:color .15s; }
.footer-location:hover, .footer-location:focus-visible { color:#34d399; text-decoration:underline; }
.forecast-controls { display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:.75rem; }
