:root {
  /* Chuns Color Palette */
  --color-primary: #6B7A2A;         /* Verde oliva */
  --color-background: #FAFAF5;      /* Blanco roto */
  --color-text-main: #2C2E1A;       /* Negro verdoso */
  --color-hero-bg: #2C3A0A;         /* Verde casi negro */
  --color-accent: #8A9A38;          /* Verde oliva claro */
  --color-secondary-bg: #F0F3E3;    /* Verde pálido */
  --color-warm-highlight: #FBF7E4;  /* Crema dorado */
  --color-text-light: #FFFFFF;      /* Blanco puro */

  /* Typography */
  --font-title: 'Caveat', cursive;
  --font-body: 'DM Sans', sans-serif;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-xxl: 5rem;

  /* Borders / Shadows */
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  --shadow-soft: 0 4px 12px rgba(44, 46, 26, 0.05);
  --shadow-hover: 0 8px 24px rgba(44, 46, 26, 0.1);
  --transition-fast: 0.2s ease;
}

/* =========================================================================
   DARK MODE
   ========================================================================= */
[data-theme="dark"] {
  --color-primary: #8A9A38;           /* Verde oliva más claro para mejor contraste */
  --color-background: #1A1D12;        /* Verde noche profundo */
  --color-text-main: #E8E6D8;         /* Crema claro */
  --color-hero-bg: #111408;           /* Negro verdoso profundo */
  --color-accent: #A3B548;            /* Verde brillante */
  --color-secondary-bg: #252A18;      /* Verde oscuro suave */
  --color-warm-highlight: #D4C78A;    /* Dorado cálido visible en dark */
  --color-text-light: #F0EDE0;        /* Crema suave */

  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Dark mode specific overrides */
[data-theme="dark"] .modal-content {
  background-color: #1E2214;
  border: 1px solid rgba(138, 154, 56, 0.15);
}

[data-theme="dark"] .value-card {
  background-color: #222818;
}

[data-theme="dark"] input,
[data-theme="dark"] select {
  background-color: #252A18;
  color: var(--color-text-main);
  border-color: rgba(138, 154, 56, 0.3);
}

[data-theme="dark"] .product-card {
  background-color: #222818;
}

[data-theme="dark"] .checkout-btn {
  background-color: #25D366;
  color: #111;
}

[data-theme="dark"] .wa-float {
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

[data-theme="dark"] .toast {
  background-color: #8A9A38;
  color: #111;
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--color-text-light);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(30deg);
}

/* Smooth transition for theme switch */
body,
body * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Don't transition images and animations (causes flicker) */
body img,
body svg,
body .ticker-animate,
body .toast,
body .chat-window {
  transition: none !important;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--color-background);
  color: var(--color-text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Custom Chuns Cursor - A subtle green sparkle */
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%236B7A2A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"/></svg>') 12 12, auto;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  line-height: 1.2;
  font-weight: 500;
}

a, button, .chat-toggle, .product-image, .cart-btn, .close-btn, .remove-btn {
  /* Pointer variant for clickables with a filled center */
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="%238A9A38" stroke="%232C3A0A" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"/><circle cx="12" cy="12" r="3" fill="%238A9A38"/></svg>') 12 12, pointer !important;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent);
}

/* Base Component Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-light);
}

.btn-primary:hover {
  background-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text-main);
  border: 1px solid var(--color-text-main);
}

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

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.section {
  padding: var(--spacing-xl) 0;
}

.text-center {
  text-align: center;
}

.section-title {
  font-size: 3rem;
  margin-bottom: var(--spacing-lg);
  color: var(--color-primary);
}

/* Header */
.header {
  background-color: var(--color-hero-bg);
  padding: 0.25rem 0; /* Tighter padding since the logo uses space */
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-soft);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo img {
  height: 80px; /* Resize logo to fit nicely in header */
  width: auto;
  display: block;
}

.nav {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
}

.nav a {
  font-weight: 500;
  color: var(--color-text-light);
}

.nav a:hover {
  color: var(--color-accent);
}

.cart-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--color-primary);
  border-radius: var(--border-radius-lg);
  transition: background-color var(--transition-fast);
}

/* Catalog hover effect */
.product-image {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.cart-btn:hover {
  background-color: var(--color-accent);
}

/* Hero Section */
.hero {
  background-color: var(--color-hero-bg);
  color: var(--color-text-light);
  padding: var(--spacing-xxl) 0;
  text-align: center;
}

.hero-content {
  max-width: 800px;
}

.hero-title {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
  color: var(--color-warm-highlight);
}

.hero-subtitle {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-lg);
  opacity: 0.9;
}

/* About Section */
.about {
  background-color: var(--color-warm-highlight);
}

.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-xl);
  align-items: center;
}

.about-text p {
  margin-bottom: var(--spacing-sm);
  font-size: 1.1rem;
}

.about-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-sm);
}

.value-card {
  background-color: var(--color-background);
  padding: var(--spacing-md);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-soft);
}

.value-card h3 {
  font-size: 1.5rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.value-card p {
  font-size: 0.9rem;
}

/* Catalog */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
}

.product-card {
  background-color: var(--color-secondary-bg);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.product-image img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
  background-color: var(--color-secondary-bg); /* Placeholder color while loading */
}

/* Ensure picture elements inside product-image fill properly */
.product-image picture {
  display: block;
  width: 100%;
  height: 280px;
  background-color: var(--color-secondary-bg);
}

.product-image picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-image:hover img {
  transform: scale(1.04); /* Subtler, more elegant zoom */
}

.product-info {
  padding: var(--spacing-md);
  text-align: center;
}

.product-name {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--spacing-sm);
}

.add-to-cart {
  width: 100%;
}

/* Modal / Cart */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(44, 46, 26, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background-color: var(--color-background);
  width: 90%;
  max-width: 500px;
  max-height: 95vh;
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-sm) var(--spacing-md);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-hover);
  /* Ensure it doesn't push past the screen */
  overflow: hidden; 
}

.close-btn {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--color-text-main);
  line-height: 1;
  z-index: 10;
}

.modal-title {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--color-secondary-bg);
  padding-bottom: var(--spacing-xs);
  flex-shrink: 0;
}

#cart-items-container {
  overflow-y: auto;
  /* Leaves room for the title and the checkout form */
  flex: 1 1 100px;
  min-height: 100px;
  max-height: 25vh; 
  padding-right: 10px;
  margin-bottom: var(--spacing-sm);
  border: 1px solid transparent; /* Ensure rendering */
}

.cart-items {
  display: flex;
  flex-direction: column;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--color-secondary-bg);
}

.cart-item-info h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.1rem;
}

.remove-btn {
  background: none;
  border: none;
  color: #d9534f;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: underline;
}

.cart-summary {
  background-color: var(--color-secondary-bg);
  padding: var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  text-align: center;
}

.cart-summary h3 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.checkout-btn {
  width: 100%;
  margin-bottom: var(--spacing-xs);
  background-color: #25D366; /* WhatsApp Green */
  color: white;
}

.checkout-btn:hover {
  background-color: #128C7E;
}

.checkout-note {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* =========================================================================
   12. INSTAGRAM GRID
   ========================================================================= */
.insta-grid {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
}

.insta-item {
  flex: 1 1 50%; /* 2 cols on mobile */
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: block;
}

@media (min-width: 768px) {
  .insta-item {
    flex: 1 1 25%; /* 4 cols on desktop */
  }
}

.insta-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.insta-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  font-weight: 600;
  font-size: 1.1rem;
}

.insta-item:hover img {
  transform: scale(1.05);
}

.insta-item:hover .insta-overlay {
  opacity: 1;
}

/* Footer */
.footer {
  background-color: var(--color-hero-bg);
  color: var(--color-secondary-bg);
  padding: var(--spacing-lg) 0;
}

.footer-logo {
  font-size: 3rem;
  color: var(--color-warm-highlight);
  margin-bottom: var(--spacing-sm);
}

.footer-copyright {
  margin-top: var(--spacing-md);
  font-size: 0.9rem;
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
  }
  
  .nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    font-size: 0.9rem;
  }

  .about-content {
    grid-template-columns: 1fr;
  }
  
  .hero-title {
    font-size: 2.4rem;
    margin-bottom: var(--spacing-sm);
  }

  .hero {
    padding: var(--spacing-xl) var(--spacing-sm);
  }
  
  .section-title {
    font-size: 2.5rem;
  }
  
  .chat-window {
    width:calc(100vw - 4rem);
    height: 60vh;
  }
}

/* Chat Widget */
.chat-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: var(--color-text-light);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-hover);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform var(--transition-fast);
}

.chat-toggle:hover {
  transform: scale(1.1);
  background-color: var(--color-accent);
}

.chat-window {
  width: 350px;
  height: 500px;
  background-color: var(--color-background);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-hover);
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-secondary-bg);
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform-origin: bottom right;
}

.chat-window.hidden {
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

.chat-header {
  background-color: var(--color-hero-bg);
  color: var(--color-warm-highlight);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  font-size: 1.5rem;
  margin: 0;
  font-family: var(--font-title);
}

.chat-messages {
  flex-grow: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-color: var(--color-background);
}

.message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.message.user {
  align-self: flex-end;
  background-color: var(--color-secondary-bg);
  color: var(--color-text-main);
  border-bottom-right-radius: 4px;
}

.message.bot {
  align-self: flex-start;
  background-color: var(--color-warm-highlight);
  color: var(--color-text-main);
  border-bottom-left-radius: 4px;
}

.chat-input-area {
  padding: 1rem;
  border-top: 1px solid var(--color-secondary-bg);
  display: flex;
  gap: 0.5rem;
  background-color: var(--color-background);
}

.chat-input {
  flex-grow: 1;
  border: 1px solid #ccc;
  border-radius: var(--border-radius-sm);
  padding: 0.5rem;
  font-family: inherit;
  outline: none;
}

.chat-input:focus {
  border-color: var(--color-primary);
}

.chat-send-btn {
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.chat-send-btn:hover {
  background-color: var(--color-accent);
}

/* =========================================================================
   18. WHATSAPP FLOAT
   ========================================================================= */
.wa-float {
  position: fixed;
  bottom: 20px;
  right: 90px; /* Offset to sit next to the chatbot */
  background-color: #25D366;
  color: #FFF;
  border-radius: 50px;
  text-align: center;
  font-size: 30px;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  z-index: 1000;
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.3s ease;
}

.wa-float:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 6px 15px rgba(37, 211, 102, 0.4);
}

/* =========================================================================
   19. ANIMATIONS & LIGHTBOX
   ========================================================================= */
/* Scroll Animation Classes */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Lightbox Overlay */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(44, 46, 26, 0.9);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.lightbox-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.lightbox-overlay.active .lightbox-content {
  transform: scale(1);
}

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--border-radius-sm);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: block;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.product-image {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.product-image::after {
  content: '🔍 Ampliar';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(107, 122, 42, 0.8);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.product-image:hover::after {
  opacity: 1;
}

/* Pulse animation for chat toggle */
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(107, 122, 42, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(107, 122, 42, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(107, 122, 42, 0); }
}

.chat-toggle {
  animation: pulse 2s infinite;
}

.chat-toggle:hover {
  animation: none;
  transform: scale(1.1);
}

/* --- ADVANCED UX: TOAST & INTERACTIONS --- */

/* Toast Hub */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background-color: var(--color-primary);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-hover);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  transform: translateX(-120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

/* Cart Badge Pop */
@keyframes popBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.5); color: var(--color-warm-highlight); }
  100% { transform: scale(1); }
}

.cart-count-pop {
  animation: popBadge 0.4s ease-out;
  display: inline-block;
}

/* Scroll to Top */
.scroll-top-btn {
  position: fixed;
  bottom: 100px; /* Above chat widget */
  right: 20px;
  width: 50px;
  height: 50px;
  background-color: var(--color-secondary-bg);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 50%;
  font-size: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 900;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s;
  box-shadow: var(--shadow-soft);
}

.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-btn:hover {
  background-color: var(--color-primary);
  color: white;
}

/* Ticker Animation */
@keyframes ticker-scroll {
  /* Translate halfway since the content is duplicated for seamless looping */
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-animate {
  display: inline-flex;
  white-space: nowrap;
  animation: ticker-scroll 35s linear infinite;
  /* Hardware acceleration for smooth scrolling */
  will-change: transform; 
}

.ticker-animate:hover {
  animation-play-state: paused;
}
