/* --- CONFIGURACIÓN GENERAL --- */
html, body {
    height: 100%; /* Obliga al documento a ocupar toda la ventana */
    margin: 0;
    padding: 0;
}

body {
    display: flex;               /* ¡CORREGIDO! Activa el contenedor flex */
    flex-direction: column;      /* Organiza header, main y footer en fila vertical */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f9;
    color: #333;
    min-height: 100vh;           /* Asegura que mida el total de la pantalla */
}

/* --- ENCABEZADO Y LOGO --- */
.header {
  display: flex;
  justify-content: space-between; 
  align-items: center;
  background-color: #0A2A5E;      
  padding: 10px 20px;
  color: white;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  height: 50px;   
  width: auto;     
  margin-right: 10px;
}

/* --- MENÚ DE NAVEGACIÓN --- */
.menu a {
  color: white;
  text-decoration: none;
  margin: 0 15px;  
  font-weight: bold;
  transition: color 0.3s ease; 
}

.menu a:hover {
  color: #FFD700; 
}

/* --- MENÚ DESPLEGABLE (DROPDOWN) --- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%; 
    left: 0;
    background-color: #0b2545; 
    min-width: 180px;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
    list-style: none;
    padding: 10px 0;
    margin: 0;
    border-radius: 0 0 6px 6px; 
    z-index: 1000; 
}

.dropdown-menu li a {
    color: #ffffff;
    padding: 10px 20px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.dropdown-menu li a:hover {
    background-color: #134074; 
}

.dropdown:hover .dropdown-menu {
    display: block;
}

/* --- CONTENIDO PRINCIPAL --- */
main {
    flex: 1 0 auto; /* ¡OPTIMIZADO! Se estira para empujar el footer al fondo absoluto */
    max-width: 1200px;
    width: 100%;
    margin: 40px auto;
    padding: 0 20px;
    box-sizing: border-box; /* Previene desbordamientos de diseño */
}

/* --- CUADRÍCULA DE PRODUCTOS (GRID) --- */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px; 
}

/* --- TARJETA DE PRODUCTO --- */
.product-card {
    background-color: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* --- CONTENEDOR DE IMAGEN / PLACEHOLDER --- */
.card-imagen-contenedor {
    background-color: #0c2340; 
    height: 200px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-letra {
    color: #ffffff;
    font-size: 4rem;
    font-weight: bold;
    opacity: 0.3;
}

.badge-temporada {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: #ffcc00; 
    color: #0c2340;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 20px;
    text-transform: uppercase;
}

/* --- INFORMACIÓN DEL PRODUCTO --- */
.card-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
}

.categoria {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.card-info h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    color: #0c2340;
}

.card-info p {
    margin: 0 0 20px 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
    flex-grow: 1;
}

/* --- SECCIÓN DE PRECIOS Y BOTÓN --- */
.card-footer-precio {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto; 
}

.precios {
    display: flex;
    flex-direction: column;
}

.precio-actual {
    font-size: 1.3rem;
    font-weight: bold;
    color: #0c2340;
}

.precio-anterior {
    font-size: 0.9rem;
    color: #999;
    text-decoration: line-through;
    margin-top: 2px;
}

/* Botón Añadir */
.btn-añadir {
    background-color: #0c2340;
    color: white;
    border: none;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-añadir:hover {
    background-color: #ffcc00;
    color: #0c2340;
}

/* --- ELEMENTO FOOTER --- */
footer {
  flex-shrink: 0;   /* Evita que se encoja la barra del footer */
  background: #2C3E50;
  color: white;
  text-align: center;
  padding: 20px;
  margin-top: auto; /* Empuja con éxito al fondo gracias a Flexbox en el body */
}

/* --- ADAPTACIÓN MÓVIL (RESPONSIVE) --- */
@media (max-width: 768px) {
    .contenedor-contacto {
        grid-template-columns: 1fr; 
    }
}
/* Contenedor principal del panel */
.carrito-panel {
    position: fixed;
    top: 0;
    right: -400px; /* Escondido por defecto a la derecha */
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background-color: #0c2340; /* Mismo azul oscuro corporativo de tus tarjetas */
    color: #ffffff;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
    transition: right 0.3s ease-in-out;
    z-index: 2000; /* Asegura estar por encima del menú desplegable */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Estado activo gatillado por JavaScript */
.carrito-panel.activo {
    right: 0;
}

/* Cabecera interna del carrito */
.carrito-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.carrito-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: #ffffff;
}

/* Botón de cierre (X) */
.btn-cerrar {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-cerrar:hover {
    color: #ffcc00; /* Amarillo de realce usado en tus badges */
}

/* Zona central con scroll para los productos */
.carrito-contenido {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Tarjeta de producto individual dentro de la lista */
.item-carrito {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.item-detalles h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: #ffffff;
}

.item-detalles p {
    margin: 0;
    color: #cbd5e1;
    font-size: 0.85rem;
}

/* Botón eliminar */
.btn-eliminar {
    background: none;
    border: none;
    color: #ff4d4d;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 5px;
    transition: opacity 0.2s;
}

.btn-eliminar:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* Base inferior del panel */
.carrito-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #0A2A5E; /* Azul del header principal */
}

.carrito-total {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.carrito-total #carrito-total-precio {
    color: #ffcc00; /* Resalta el dinero total con tu color secundario */
}

/* Botón de acción para pagar */
.btn-pagar {
    width: 100%;
    background-color: #ffcc00; 
    color: #0c2340;
    border: none;
    padding: 14px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-pagar:hover {
    background-color: #e6b800;
}

.btn-pagar:active {
    transform: scale(0.98);
}

/* Capa translúcida trasera (Fondo desenfocado) */
.overlay-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px); /* Agrega un sutil desenfoque elegante */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1999;
}

.overlay-panel.activo {
    opacity: 1;
    pointer-events: auto;
}

/* Soporte adaptativo para pantallas móviles */
@media (max-width: 480px) {
    .carrito-panel {
        max-width: 100%;
        right: -100%;
    }
}