@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
    --primary-color: #22c55e;
    --secondary-color: #f97316;
    --accent-color: #6b7280;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --background: #ffffff;
    --card-background: #f9fafb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
}

/* Optimizaciones de imágenes */
.product-card img,
.category-grid img,
.modal img {
    content-visibility: auto;
    loading: lazy;
}

.critical-image {
    fetchpriority: high;
}

.category-card {
    @apply bg-white rounded-xl shadow-sm border border-gray-100 p-3 sm:p-4 text-center transition-all duration-200 active:scale-95 relative overflow-hidden;
}

@media (max-width: 640px) {
    .category-card {
        @apply p-2;
    }
    
    .category-card .category-icon {
        @apply w-8 h-8 mb-1;
    }
    
    .category-card .category-name {
        @apply text-xs;
    }
}

.category-card:hover {
    @apply shadow-md border-[var(--primary-color)] border-opacity-30;
}

.product-card {
    @apply bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden transition-all duration-200 cursor-pointer;
}

.product-card:hover {
    @apply shadow-md transform scale-105;
}

.header-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Ajustes mejorados de imágenes de productos === */
.product-card img {
    width: 100%;
    max-width: 500px;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background-color: #fff;
    padding: 8px;
    transition: transform 0.3s ease;
}

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

@media (max-width: 640px) {
    .product-card img {
        max-width: 100%;
        height: auto;
        max-height: 350px;
        padding: 5px;
    }
    
    .grid.grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .product-card {
        margin: 0.25rem;
    }
}

/* === Corrección para superposición de imágenes sobre el texto === */
.product-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    padding-bottom: 0.5rem;
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .product-card img {
        height: 220px;
    }
}

/* === Separación clara entre categorías y productos === */
section {
    position: relative;
    z-index: 1;
}

.categories-section {
    margin-bottom: 2rem;
}

.products-section {
    clear: both;
    margin-top: 2rem;
    position: relative;
    z-index: 2;
}

/* === Banner para vista móvil === */
.mobile-banner {
    width: 100%;
    max-width: 423px;
    height: 470px;
    aspect-ratio: 9/10;
    margin: 0 auto;
    display: block;
}

.mobile-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

@media (min-width: 768px) {
    .mobile-banner {
        display: none;
    }
}

@media (max-width: 767px) {
    .mobile-banner {
        display: block;
    }
}

/* === IMAGEN DEL MODAL DE PRODUCTO - MOSTRAR COMPLETA === */
.product-detail-modal img {
    width: 100%;
    max-width: 500px;
    height: auto;
    max-height: 500px;
    object-fit: contain !important;
    display: block;
    margin: 0 auto;
    background-color: #f8f9fa;
    padding: 10px;
}

@media (max-width: 640px) {
    .product-detail-modal img {
        max-height: 400px;
        max-width: 100%;
        object-fit: contain !important;
    }
}

@media (min-width: 1024px) {
    .product-detail-modal img {
        max-height: 500px;
        max-width: 500px;
        object-fit: contain !important;
    }
}

/* === MODAL DE MUNICIPIO === */
.municipality-modal-container {
    z-index: 60;
}

.municipality-modal-content {
    max-height: 90vh;
    overflow: hidden;
}

@media (max-width: 640px) {
    .municipality-modal-container {
        align-items: flex-end;
        padding: 0;
    }
    
    .municipality-modal-content {
        max-height: 85vh;
        border-radius: 1rem 1rem 0 0;
        margin: 0;
        width: 100%;
    }
    
    .municipality-modal-content .max-h-96 {
        max-height: 50vh;
    }
}

@keyframes scale-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: scale-in 0.3s ease-out;
}

/* ICONOS PARA CATEGORÍAS */
.icon-beef::before { content: "🥩"; }
.icon-milk::before { content: "🥛"; }
.icon-wheat::before { content: "🌾"; }
.icon-can::before { content: "🥫"; }
.icon-broom::before { content: "🧼"; }
.icon-basket::before { content: "🛒"; }
.icon-shopping-basket::before { content: "🛒"; }
.icon-tag::before { content: "🏷️"; }
.icon-package::before { content: "📦"; }
.icon-arrow-right::before { content: "➡️"; }
.icon-share-2::before { content: "🔗"; }
.icon-map-pin::before { content: "📍"; }
.icon-check::before { content: "✓"; }
.icon-info::before { content: "ℹ️"; }

/* Optimizaciones de rendimiento */
.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease-in forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Estilos para el botón de compartir */
.share-button {
    @apply bg-[var(--primary-color)] text-white px-4 py-2 rounded-lg font-medium flex items-center justify-center space-x-2 hover:bg-opacity-90 transition-all;
}

/* === SECCIÓN FAQ - NUEVA === */

/* Animaciones mejoradas para FAQ */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fade-in 0.3s ease-out;
}

/* Iconos adicionales para FAQ */
.icon-help-circle::before { content: "❓"; }
.icon-phone::before { content: "📞"; }
.icon-chevron-down::before { content: "⬇️"; }
.icon-truck::before { content: "🚚"; }
.icon-shield::before { content: "🛡️"; }
.icon-star::before { content: "⭐"; }

/* Estilos responsivos mejorados para FAQ */
@media (max-width: 640px) {
  #faq {
    padding: 2rem 1rem !important;
  }
  
  #faq h2 {
    font-size: 1.75rem !important;
  }
  
  .faq-grid {
    grid-template-columns: 1fr !important;
  }
  
  .faq-item button {
    padding: 1rem 1.25rem !important;
    font-size: 0.9rem !important;
  }
  
  .faq-answer {
    padding: 1rem 1.25rem !important;
    font-size: 0.875rem !important;
  }
  
  .cta-buttons {
    flex-direction: column !important;
  }
  
  .info-cards {
    grid-template-columns: 1fr !important;
  }
}

/* Mejoras de hover y transiciones para FAQ */
.faq-item {
  transition: all 0.3s ease;
}

.faq-item:hover {
  transform: translateY(-2px);
}

.cta-button {
  transition: all 0.3s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* === TEMÁTICA NAVIDEÑA === */

/* Fondo navideño sutil para el header */
.header-gradient {
    background: linear-gradient(135deg, #1a936f 0%, #c72c41 100%);
    position: relative;
    overflow: hidden;
}

.header-gradient::before {
    content: "🎄";
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    opacity: 0.8;
}

.header-gradient::after {
    content: "⭐";
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 1.2rem;
    opacity: 0.7;
}

/* Efectos navideños en las tarjetas */
.product-card {
    position: relative;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(220, 38, 38, 0.1);
    border-color: #dc2626;
}

/* Badge navideño para productos especiales */
.christmas-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(45deg, #dc2626, #ea580c);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    z-index: 10;
    animation: pulse-christmas 2s infinite;
}

@keyframes pulse-christmas {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Botones con temática navideña */
.christmas-button {
    background: linear-gradient(45deg, #dc2626, #ea580c) !important;
    color: white !important;
    position: relative;
    overflow: hidden;
}

.christmas-button::before {
    content: "🎁";
    position: absolute;
    right: 10px;
    opacity: 0.8;
}

/* Efectos de nieve sutil */
.snow-effect {
    position: relative;
    overflow: hidden;
}

.snow-effect::after {
    content: "❄";
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Banner navideño especial */
.christmas-banner {
    background: linear-gradient(135deg, #1a936f 0%, #c72c41 50%, #1e40af 100%);
    color: white;
    padding: 1rem;
    text-align: center;
    border-radius: 12px;
    margin: 1rem auto;
    position: relative;
    overflow: hidden;
}

.christmas-banner::before {
    content: "🎄🎅✨";
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.christmas-banner::after {
    content: "✨🎁🎄";
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

/* Iconos navideños para categorías */
.icon-christmas::before { content: "🎄"; }
.icon-gift::before { content: "🎁"; }
.icon-snowflake::before { content: "❄"; }
.icon-santa::before { content: "🎅"; }
.icon-reindeer::before { content: "🦌"; }

/* Efecto de luces parpadeantes */
@keyframes twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.twinkle {
    animation: twinkle 2s infinite;
}

/* Modal navideño */
.christmas-modal {
    border: 2px solid #dc2626;
    border-radius: 16px;
}

.christmas-modal::before {
    content: "🎄";
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 5px;
    border-radius: 50%;
    font-size: 1.2rem;
}

/* Productos especiales navideños */
.christmas-special {
    border: 2px solid #dc2626;
}

/* Banner navideño superior */
.christmas-top-banner {
    background: linear-gradient(90deg, #1a936f 0%, #c72c41 50%, #1e40af 100%);
    color: white;
    padding: 0.5rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}