/* ─── CSS Rústico personalizado - Optimizado para usuarios +50 años v2 ─── */

/* ─── Forzar fondo claro y color de texto oscuro en todos los modos ─── */
html, body {
  background-color: #fefdf8 !important;
  color: #3c2e21 !important;
  color-scheme: light !important;
}

html {
  color-scheme: light !important;
}

/* Forzar texto oscuro en todos los elementos - SIN afectar botones */
*:not(button):not(.btn-rustic):not(.btn-secondary):not(.btn-danger):not([class*="btn-"]):not([style]) {
  border-color: #e7d9b8;
}

@media (prefers-color-scheme: dark) {
  html, body {
    color-scheme: light !important;
    background-color: #fefdf8 !important;
    color: #3c2e21 !important;
  }
}

/* ─── Fondo texturizado ─── */
.bg-rustic {
  background-color: #fefdf8;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23faedcd' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ─── Forzar fondo blanco solo en la card raíz, no en hijos ─── */
.product-card,
.product-card.bg-white {
  background-color: #ffffff;
}

/* ─── Navbar con presencia y separación del contenido ─── */
.nav-rustic {
  background: rgba(253, 246, 232, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid #d4a373;
  /* Sombra que separa claramente el navbar del contenido */
  box-shadow: 0 6px 20px rgba(60, 46, 33, 0.07),
              0 2px 6px rgba(60, 46, 33, 0.04);
  font-size: 1.1875rem; /* 19px - más legible */
}

.nav-rustic a {
  font-weight: 600;
}

/* ─── Card de producto con hover rústico ─── */
.product-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(212, 163, 115, 0.2);
  border-radius: 1rem;
  background-color: #ffffff;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(200, 120, 86, 0.15);
  border-color: rgba(200, 120, 86, 0.4);
}

.product-card img {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover img {
  transform: scale(1.05);
}

/* ─── Botones rústicos - Aún más grandes para +50 ─── */
.btn-rustic {
  background: linear-gradient(135deg, #c87856, #b56240);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(200, 120, 86, 0.3);
  transition: all 0.2s ease;
  font-size: 1.1875rem; /* 19px */
  font-weight: 700;
  padding: 1rem 1.75rem; /* más padding */
  min-height: 56px; /* WCAG touch target más generoso */
}

.btn-rustic:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 120, 86, 0.4);
}

.btn-rustic:active {
  transform: scale(0.98);
}

/* ─── Línea decorativa rústica ─── */
.rustic-divider {
  height: 2px;
  background: linear-gradient(to right, transparent, #d4a373, transparent);
  border: none;
  margin: 2rem 0;
}

/* ─── Badge de categoría ─── */
.category-badge {
  background: #e8a98a;
  color: #3c2e21;
  border-radius: 9999px;
  padding: 0.5rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.2s;
  border: 1px solid rgba(150, 78, 54, 0.15);
}

.category-badge:hover {
  background: #dc835f;
  color: white;
  border-color: transparent;
}

/* ─── WhatsApp floating button - Más grande desktop, más pequeño móvil ─── */
.whatsapp-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 50;
  width: 64px;
  height: 64px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
  transition: all 0.3s;
  animation: float 3s ease-in-out infinite;
  border: none;
  cursor: pointer;
}

@media (min-width: 768px) {
  .whatsapp-float {
    bottom: 2rem;
    right: 2rem;
    width: 80px;
    height: 80px;
  }
}

.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

/* ─── Scroll reveal (no-JS fallback: visible by default) ─── */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

html.js-ready .reveal {
  opacity: 0;
  transform: translateY(30px);
}

html.js-ready .reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Lightbox overlay ─── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 100;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  display: none;
}

.lightbox-overlay:not(.hidden) {
  display: flex;
}

.lightbox-image {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  cursor: default;
  border-radius: 8px;
}

/* ─── Ajustes de texto para +50 (todo más grande) ─── */
.product-card h3 {
  font-size: 1.375rem !important; /* 22px */
  line-height: 1.3;
  font-weight: 700;
}

.product-card .text-sm {
  font-size: 1rem !important; /* 16px en lugar de 14px */
}

.product-card .text-lg {
  font-size: 1.375rem !important; /* 22px */
}

nav a {
  font-size: 1.125rem; /* 18px */
  font-weight: 600;
}

footer h3, footer h4 {
  font-size: 1.375rem; /* 22px */
  margin-bottom: 0.75rem;
  font-weight: 700;
}

footer p, footer a {
  font-size: 1rem; /* 16px */
  line-height: 1.7;
}

/* ─── Formularios más grandes ─── */
input, textarea, select {
  font-size: 1.1875rem !important; /* 19px */
  padding: 0.875rem 1.125rem !important;
  min-height: 56px;
  line-height: 1.5;
}

button {
  font-size: 1.125rem; /* 18px */
  font-weight: 600;
}

label {
  font-size: 1.0625rem; /* 17px */
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

/* ─── Modal QR de WhatsApp ─── */
.whatsapp-qr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease-out;
  display: none;
}

.whatsapp-qr-overlay:not(.hidden) {
  display: flex;
}

.whatsapp-qr-content {
  background: #fefdf8;
  border-radius: 1.5rem;
  padding: 2.5rem 2rem;
  max-width: 36rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  animation: scaleIn 0.3s ease-out;
}

.whatsapp-qr-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  background: #faedcd;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #3c2e21;
  transition: all 0.2s;
}

.whatsapp-qr-close-btn:hover {
  background: #c87856;
  color: white;
  transform: rotate(90deg);
}

#whatsapp-qr-image {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

#whatsapp-qr-message {
  max-height: 12rem;
  overflow-y: auto;
  background: white;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #e7d9b8;
}

@media (max-width: 640px) {
  .whatsapp-qr-content {
    padding: 2rem 1.25rem;
  }
  #whatsapp-qr-image {
    width: 14rem;
    height: 14rem;
  }
}

/* ═══════════════════════════════════════════════
   MEJORAS DE CONTRASTE WCAG AA (v3)
   ═══════════════════════════════════════════════ */

/* Forzar contraste mínimo 4.5:1 en textos sobre fondo blanco/claro */
.text-madera-500 {
  color: #735641 !important; /* madera-700 - 5.2:1 sobre blanco */
}

.text-madera-600 {
  color: #5f4739 !important; /* madera-800 - 7.3:1 sobre blanco */
}

/* Precio de producto - contraste sobre blanco */
.text-terracota-600,
.text-terracota-500 {
  color: #964e36 !important; /* terracota-700 - 4.7:1 sobre blanco */
}

/* Botones secundarios con borde visible */
.btn-secondary {
  background: #f9e8dd !important; /* terracota-100 */
  color: #7a4132 !important; /* terracota-800 */
  border: 2px solid #dc835f !important; /* terracota-400 */
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #dc835f !important; /* terracota-400 */
  color: white !important;
  border-color: #b56240 !important;
}

/* Botón de peligro/peligro */
.btn-danger {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border: 2px solid #fca5a5 !important;
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
}

/* Enlaces secundarios más visibles */
a.text-madera-600,
a.text-madera-500 {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Focus rings más visibles para accesibilidad teclado */
*:focus-visible {
  outline: 3px solid #b56240 !important;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Cursor pointer en todo elemento cliqueable */
a[href],
button,
[onclick],
[role="button"],
input[type="submit"],
input[type="button"],
select {
  cursor: pointer;
}

/* Toast de carrito - diseño mejorado */
#cart-toast,
.toast-notification {
  background: #3c2e21 !important;
  color: #fefdf8 !important;
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 1.125rem;
  font-weight: 600;
  padding: 1rem 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

/* Estado deshabilitado en botones */
button:disabled,
button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Spinner de carga simple */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* Texto de ayuda/placeholder con contraste suficiente */
::placeholder {
  color: #735641 !important;
  opacity: 0.7;
}

/* Cart item price */
.cart-item-price {
  color: #964e36 !important;
  font-weight: 700;
}
