/* ==========================================
   1. VARIABLES Y CONFIGURACIÓN GLOBAL
   ========================================== */
:root {
  --primary: #0099ff;
  --primary-light: #e6f4ff;
  --primary-dark: #005580;
  --bg-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #1a202c;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 4px 12px rgba(0, 153, 255, 0.1);
}

html { scroll-behavior: smooth; }

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  background-color: var(--bg-alt);
  padding-top: 90px;
  color: var(--text);
}

/* ==========================================
   2. HEADER Y BARRA DE BÚSQUEDA (MODERNA)
   ========================================== */
header {
  position: fixed;
  top: 0;
  width: 100%;
  background: white;
  padding: 0.8rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo-container { display: flex; align-items: center; gap: 10px; }
.logo-img { height: 45px; border-radius: 50%; }

/* Lógica de Texto del Logo */
.logo-text-mobile { display: none; }
.logo-text-desktop { 
  display: block; 
  font-size: 1.6rem; 
  font-weight: 800; 
  color: var(--primary-dark); 
}

/* Contenedor Cápsula de Búsqueda */
.search-filter {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #f1f5f9;
    padding: 6px 15px;
    border-radius: 50px;
    border: 1px solid var(--border);
    transition: var(--transition);
    flex: 0.8; /* Le da prioridad de ancho */
}

.input-group {
    display: flex;
    align-items: center;
    background: transparent;
    flex: 1;
}

#search, #category {
    border: none !important;
    background: transparent !important;
    outline: none !important;
    padding: 8px 0;
    font-size: 0.9rem;
    width: 100%;
}

#category {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-dark);
    width: auto;
    min-width: 80px;
}

/* ==========================================
   3. HERO Y GRILLA DE PRODUCTOS
   ========================================== */
/* ==========================================
   3. HERO Y GRILLA DE PRODUCTOS (CORREGIDO)
   ========================================== */
#hero {
  min-height: 60vh; /* Cambiamos height por min-height para que crezca si es necesario */
  background: linear-gradient(135deg, rgba(0, 153, 255, 0.8), rgba(0, 85, 128, 0.9)), 
              url('imagen/Logo.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  border-radius: 0 0 40px 40px;
  margin-bottom: 2rem;
  padding: 40px 20px; /* Añadimos espacio para que no toque los bordes en móvil */
}

.hero-text {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  padding: 2rem; /* Reducimos un poco el padding */
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 90%;      /* Asegura que no sea más ancho que la pantalla */
  max-width: 600px; /* Evita que se vea demasiado ancho en PC */
}

.hero-text h1 {
  font-size: clamp(2rem, 8vw, 3.5rem); /* Ajusta el tamaño del título según la pantalla */
  margin-bottom: 10px;
  line-height: 1.2;
}

.hero-text p {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
  gap: 15px;
  padding: 20px 5%;
  max-width: 1400px;
  margin: 0 auto;
}

#productos-main { scroll-margin-top: 110px; }

.section-header {
  grid-column: 1 / -1; 
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 10px;
  margin: 20px 0 10px 0;
  scroll-margin-top: 110px;
}

.product-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 153, 255, 0.1);
  border-color: var(--primary);
}

.product-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  margin-bottom: 8px;
}

/* ==========================================
   4. MODAL Y CARRITO
   ========================================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal[aria-hidden="false"] { opacity: 1; visibility: visible; }

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

/* Bloqueo del scroll del cuerpo cuando el carrito está abierto */
body.cart-open {
    overflow: hidden;
}

.cart-sidebar {
    position: fixed;
    right: -400px;
    top: 0;
    width: 350px;
    height: 100vh; /* Altura completa de la pantalla */
    background: white;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    z-index: 3000;
    transition: right 0.3s ease-in-out;
    padding: 1.5rem;
    
    /* Configuración para que el contenido interno sea flexible */
    display: flex;
    flex-direction: column; 
}

/* Área de los productos: Se vuelve desplazable */
#cart-items {
    flex: 1;            /* Toma todo el espacio disponible entre el título y el total */
    overflow-y: auto;   /* Habilita la barra de desplazamiento si hay muchos productos */
    margin-top: 20px;
    padding-right: 10px; /* Espacio para que la barra no tape el botón de eliminar */
    list-style: none;
}

/* Estilo opcional para que la barra de desplazamiento se vea más limpia */
#cart-items::-webkit-scrollbar {
    width: 6px;
}
#cart-items::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

.cart-sidebar.open { right: 0; }

/* === CORRECCIÓN DEFINITIVA DE IMÁGENES EN CARRITO === */
/* === AJUSTE FORZADO DE IMÁGENES EN EL PEDIDO === */
.cart-item-modern {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    padding: 10px 0 !important;
    position: relative !important;
}

/* Este es el contenedor cuadrado de la foto */
.cart-product-img {
    width: 65px !important;  /* Tamaño fijo pequeño */
    height: 65px !important; /* Tamaño fijo pequeño */
    flex-shrink: 0 !important;
    background: #f1f5f9 !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

/* Esta es la imagen real dentro del cuadro */
.cart-product-img img {
    max-width: 90% !important; /* Para que no toque los bordes */
    max-height: 90% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important; /* Evita que se deforme la botella */
    display: block !important;
}

/* ==========================================
   5. BOTONES Y WHATSAPP
   ========================================== */
.cta-button, #add-to-cart-modal, #checkout {
  background: var(--primary);
  color: white;
  padding: 1rem;
  border-radius: 50px;
  border: none;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  text-align: center;
}

/* === Botón flotante de WhatsApp con animación === */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: #25D366; /* Verde oficial de WhatsApp */
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  text-decoration: none;
  transition: 
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), 
    box-shadow 0.25s ease;
}

.whatsapp-float img {
  width: 32px;
  height: 32px;
}

/* Efecto de agrandar al hacer hover o clic */
.whatsapp-float:hover,
.whatsapp-float:focus,
.whatsapp-float:active {
  transform: scale(1.12);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

/* Tooltip (texto emergente) */
.whatsapp-tooltip {
  position: absolute;
  right: 72px;
  background: #333;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(10px);
  transition: opacity 0.2s, transform 0.2s;
}

.whatsapp-float:hover .whatsapp-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* En móviles: ocultar tooltip y ajustar tamaño */
@media (max-width: 768px) {
  .whatsapp-tooltip {
    display: none;
  }
  .whatsapp-float {
    width: 60px;
    height: 60px;
  }
  .whatsapp-float img {
    width: 28px;
    height: 28px;
  }
}
/* ==========================================
   6. RESPONSIVO (OPTIMIZACIÓN MÓVIL)
   ========================================== */
@media (max-width: 600px) {
  header { padding: 0.5rem 3%; }
  
  .logo-text-desktop { display: none; }
  .logo-text-mobile { display: block; font-weight: 800; color: var(--primary-dark); font-size: 1.3rem; }

  .search-filter {
    flex: 1;
    margin: 0 5px;
    padding: 4px 10px;
    border-radius: 15px;
  }

  #category { min-width: 60px; font-size: 0.8rem; }
  
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  
  .cart-sidebar { width: 100%; right: -100%; }
}
/* Ajuste para la imagen dentro del modal */
#modal-img {
    display: block;
    margin: 0 auto 15px auto; /* Centra la imagen y añade espacio abajo */
    max-width: 200px;         /* Limita el ancho máximo (ajústalo a tu gusto) */
    max-height: 200px;        /* Limita la altura máxima */
    object-fit: contain;      /* Mantiene la proporción sin deformar la botella */
    border-radius: 12px;      /* Bordes suaves opcionales */
    background-color: #f9f9f9; /* Fondo suave para resaltar el producto */
    padding: 10px;
}

/* Opcional: Centrar el contenido del modal para que se vea más ordenado */
.modal-content {
    text-align: center;
}

/* Alineación de los selectores (fragancia y presentación) a la izquierda */
#fragancia-selector-container, 
#variant-selector-container {
    text-align: left;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}
footer {
  background: linear-gradient(to bottom, #ffffff, #f1f5f9);
  padding: 60px 5% 30px 5%;
  border-top: 4px solid var(--primary);
  color: var(--text);
  margin-top: 50px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .footer-logo {
  height: 60px;
  border-radius: 50%;
  margin-bottom: 15px;
  box-shadow: var(--shadow);
}

.footer-brand h3 {
  color: var(--primary-dark);
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.footer-brand p {
  font-style: italic;
  color: #64748b;
}

.footer-links h4, .footer-social h4 {
  color: var(--primary-dark);
  margin-bottom: 20px;
  position: relative;
}

.footer-links ul {
  list-style: none;
}

.footer-links ul li {
  margin-bottom: 10px;
}

.footer-links ul li a {
  text-decoration: none;
  color: #475569;
  transition: var(--transition);
}

.footer-links ul li a:hover {
  color: var(--primary);
  padding-left: 5px;
}

.footer-bottom {
  text-align: center;
  padding-top: 30px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: #94a3b8;
}

.dev-text {
  margin-top: 5px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.75rem;
}

/* Ajuste móvil */
@media (max-width: 600px) {
  .footer-main {
    text-align: center;
  }
  .footer-links ul li a:hover {
    padding-left: 0;
  }
}
/* Botón de eliminar (la X) */
.remove-btn {
    background: #fee2e2; /* Rojo muy suave */
    color: #ef4444;    /* Rojo vibrante */
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.remove-btn:hover {
    background: #ef4444;
    color: white;
    transform: rotate(90deg); /* Efecto visual al pasar el mouse */
}

/* Controles de cantidad (+ y -) en el carrito */
.cart-qty-controls {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 2px 8px;
    gap: 10px;
}

.cart-qty-controls button {
    background: white;
    border: 1px solid #e2e8f0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.cart-qty-controls button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.cart-qty-controls span {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 20px;
    text-align: center;
}
/* Ajuste para el selector de cantidad del Modal */
.qty-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.qty-controls button {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 2px solid var(--primary-light);
    background: white;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.qty-controls button:hover {
    background: var(--primary);
    color: white;
}

#modal-qty {
    width: 50px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    border: none;
    background: transparent;
}
/* Estilo unificado para todas las X de cerrar ventanas (Modales y Carrito) */
.close-modal, #close-cart {
    background: #f1f5f9;      /* Gris muy suave de fondo */
    color: #64748b;           /* Color gris azulado elegante */
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 10px;      /* Bordes ligeramente redondeados, no círculo total */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 300;         /* Una X más delgada se ve más moderna */
    cursor: pointer;
    transition: var(--transition);
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

.close-modal:hover, #close-cart:hover {
    background: #fee2e2;      /* Cambia a un rojo suave al pasar el mouse */
    color: #ef4444;           /* La X se pone roja */
    transform: scale(1.1);    /* Crece un poquito */
} 
/* === SELECTORES CON BORDE Y PROFUNDIDAD PARA QUE SEAN INTUITIVOS === */
#product-variant, 
#product-fragancia {
    width: 100%;
    padding: 14px 45px 14px 15px; /* Más espacio a la derecha para la flecha */
    border-radius: 12px;
    border: 2px solid #cbd5e1; /* Gris medio que se nota claramente */
    background-color: #ffffff;  /* Fondo blanco puro para resaltar */
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    appearance: none; 
    
    /* Flecha azul más llamativa */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230099ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
    
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Sutil sombra hacia abajo */
    margin-top: 8px;
}

/* Efecto cuando el cliente hace clic o pasa el mouse */
#product-variant:hover, 
#product-fragancia:hover {
    border-color: var(--primary); /* El borde se vuelve azul */
    background-color: #f0f9ff;
}

#product-variant:focus, 
#product-fragancia:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 153, 255, 0.15); /* Brillo azul de enfoque */
}
/* === ESTILOS DEL MODAL DE CONFIRMACIÓN === */
.checkout-header {
    text-align: center;
    margin-bottom: 25px;
}

.checkout-header h3 {
    font-size: 1.8rem;
    color: var(--primary-dark);
}

.checkout-header p {
    color: #64748b;
    font-size: 0.9rem;
}

/* Pasos del proceso */
.process-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-light);
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.step-item {
    text-align: center;
    flex: 1;
}

.step-number {
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.step-item p {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.step-arrow {
    color: var(--primary);
    font-weight: bold;
}

/* Formulario Moderno */
.modern-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-container {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.input-container label {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: #475569;
}

.modern-form input {
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
}

.modern-form input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 153, 255, 0.1);
}

/* Caja de información de pago */
.payment-info-box {
    background: #fff9eb;
    border-left: 4px solid #f59e0b;
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    margin: 10px 0;
}

.payment-info-box p {
    font-size: 0.85rem;
    color: #92400e;
    line-height: 1.4;
}

.cta-button-whatsapp {
    background: #25D366; /* Verde WhatsApp */
    color: white;
    padding: 15px;
    border-radius: 12px;
    border: none;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.cta-button-whatsapp:hover {
    background: #1eb956;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

@media (max-width: 768px) {
    /* 1. Header Fijo con mayor altura para contener todo */
    header {
        padding: 10px 4%;
        height: auto; /* Deja que crezca según el contenido */
        flex-direction: column; /* Apila logo arriba y buscador abajo */
        gap: 8px;
        position: fixed;
        top: 0;
        width: 100%;
        background: white;
        z-index: 2000;
        box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    }

    /* Ajuste para el logo y el carrito en la misma línea */
    .logo-container {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* 2. Barra de búsqueda y filtro: Siempre arriba */
    .search-filter {
        position: relative; /* Ya no es flotante abajo */
        bottom: 0;
        left: 0;
        width: 100%; /* Ocupa todo el ancho */
        display: flex;
        gap: 8px;
        padding: 8px 12px;
        background: #f1f5f9;
        border-radius: 12px;
        box-shadow: none;
        border: 1px solid var(--border);
    }

    /* 3. Empujar el contenido hacia abajo para que no lo tape el header */
    body {
        padding-top: 135px; /* Ajusta este valor según cuánto mida tu header final */
    }

    /* Ajuste del Hero para que no quede pegado */
    #hero {
        margin-top: 10px;
        min-height: 40vh;
        border-radius: 0 0 25px 25px;
    }

    /* Grilla de productos (2 columnas) */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 15px;
    }

    /* Carrito a pantalla completa */
    .cart-sidebar {
        width: 100%;
        z-index: 3000;
    }
}
