/* --- Importación de fuentes y configuración básica (Mobile First) --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* --- Variables CSS (Custom Properties) para un tema consistente --- */
:root {
    --primary-color: #9d4edd; /* Nuevo color principal (morado) */
    --primary-color-dark: #823eb8; /* Tono más oscuro para estados :hover, :active */
    --primary-color-light: #b872ff; /* Tono más claro para fondos sutiles */
    --secondary-color: #3498db;
    --success-color: #28a745;
    --danger-color: #e74c3c;
    --facebook-color: #3b5998;

    --text-dark: #333;
    --text-medium: #666;
    --text-light: #999;
    --text-on-primary: #fff; /* Cambiado a blanco para mejor contraste sobre el naranja */
    --text-on-dark-bg: #fff; 

    --bg-light: #fff;
    --bg-medium: #f8f8f8;
    --bg-page: #f0f2f5;
    --border-color: #ddd;
    --border-color-light: #eee;

    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 -2px 5px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 -2px 10px rgba(0,0,0,0.1);

    --border-radius-sm: 5px;
    --border-radius-md: 8px;
    --border-radius-lg: 10px;
    --border-radius-pill: 20px;
    --border-radius-circle: 50%;
    --font-family-base: 'Roboto', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family-base);
}

body {
    background-color: var(--bg-page);
    color: var(--text-dark);
    min-width: 320px; /* Evita que el layout se rompa en dispositivos muy pequeños */
}

/* Gradiente de fondo específico para la página de inicio */
.home-page {
    /* El gradiente se extiende desde el naranja hasta el fondo, creando la ilusión de que el contenido pasa por encima */
    background: linear-gradient(to bottom, var(--primary-color) 0%, var(--primary-color) 220px, var(--bg-page) 320px);
}

/* Clase para ocultar elementos visualmente pero mantenerlos accesibles para lectores de pantalla */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Header (Barra superior) */
.header {
    background-color: var(--primary-color);
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Un poco más de espacio entre los elementos del header */
}

/* Estilo de gradiente específico para el header de la página de inicio */
.home-page .header {
    /* Hacemos el header transparente para que se vea el gradiente del body */
    background: none;
}

.header-top-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-icon-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-on-primary);
    font-size: 20px;
    position: relative; /* Para posicionar el contador del carrito */
}

.search-bar {
    flex-grow: 1;
    display: flex; /* Para que el input ocupe el espacio */
}

.search-bar input[type="search"] {
    flex-grow: 1;
    border: none;
    border-radius: var(--border-radius-pill);
    padding: 8px 15px;
    outline: none;
    font-size: 14px;
    width: 100%;
}

.cart-counter {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: var(--danger-color);
    color: var(--text-on-dark-bg);
    border-radius: var(--border-radius-circle);
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.postal-code {
    /* Reseteo para que el <button> se vea como el div original */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Contenido Principal */
.main-content {
    /* Eliminamos el padding superior para juntar el carrusel al header */
    padding: 0 10px 60px; 
}

.promo-carousel-section {
    text-align: center;
    margin-bottom: 15px; /* Espacio consistente con otras secciones */
}

/* Estilos del Carrusel de Promociones */
.promo-carousel {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    height: 180px; /* Altura fija para que no colapse al usar slides absolutos */
}

.carousel-slides {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.carousel-slide {
    min-width: 100%;
    box-sizing: border-box;
}

.promo-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-radius: var(--border-radius-lg);
    color: var(--text-on-dark-bg);
    text-decoration: none;
    height: 180px; /* Altura fija para el banner */
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

/* Fondos específicos para cada banner */
.ps5-banner {
    background: linear-gradient(135deg, #003087, #0052cc);
}
.tv-banner {
    background: linear-gradient(135deg, #1f1f1f, #4a4a4a);
}
.iphone-banner {
    background: linear-gradient(135deg, #5a6e8a, #2c3e50);
}
.galaxy-banner {
    background: linear-gradient(135deg, #1e3a8a, #4c1d95); /* Un gradiente azul/púrpura para Samsung */
}

.promo-banner-content {
    z-index: 2;
    flex-basis: 60%;
}

.promo-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 5px;
}

.promo-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 15px;
}

.promo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.promo-tag {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: var(--border-radius-pill);
    font-size: 11px;
    font-weight: 500;
}

.promo-banner-image {
    flex-basis: 40%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promo-banner-image img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: background-color 0.3s;
}

.dot.active {
    background-color: white;
}

.contact-agent {
    /* Ajustes para que encaje bien en el header */
    margin: 0;
    font-size: 13px;
    color: var(--text-on-primary);
    text-align: center;
}

/* Sección de Categorías */
.categories {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    margin-bottom: 15px;
    overflow-x: auto; /* Permite el scroll horizontal */
    /* Ocultar la barra de scroll */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.categories::-webkit-scrollbar {
    display: none; /* Chrome, Safari y Opera */
}

.category-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-light);
    border-radius: var(--border-radius-pill);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap; /* Evita que el texto del botón se parta */
    transition: background-color 0.2s, color 0.2s;
}

.category-btn.active {
    background-color: var(--text-dark);
    color: var(--text-on-dark-bg);
    border-color: var(--text-dark);
}

/* Grilla de Productos (Ahora contiene los enlaces) */
.product-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columnas en móvil por defecto */
    gap: 15px; /* Aumentamos el espacio entre tarjetas */
}

.product-main-link {
    text-decoration: none; /* Elimina el subrayado del enlace */
    color: inherit; /* Hereda el color del texto */
    display: flex; /* Permite usar flexbox para la disposición interna */
    flex-direction: column; /* Apila la imagen y la info verticalmente */
    width: 100%; /* Ocupa todo el ancho de la celda de la grilla */
    height: 100%; /* Ocupa todo el alto de la celda (grid estira los items por defecto) */
    background-color: var(--bg-light); /* Fondo blanco para la tarjeta */
    border-radius: var(--border-radius-lg); /* Bordes redondeados */
    box-shadow: var(--shadow-sm); /* Sombra sutil */
    overflow: hidden; /* Asegura que el contenido no se desborde */
    position: relative; /* Para posicionar elementos internos si es necesario */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Transiciones suaves */
}

.product-main-link:hover {
    transform: translateY(-3px); /* Efecto de elevación al pasar el mouse */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); /* Sombra más pronunciada */
}

.product-card { /* Este es el contenedor de la tarjeta y el botón de favorito */
    position: relative; /* Necesario para posicionar el botón de favorito */
    /* Las propiedades flex no son necesarias aquí, ya que el grid estira el item y el enlace interno ocupa el 100% */
}

.product-image-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1; /* Mantiene una proporción cuadrada, ideal para imágenes de producto */
    display: flex; /* Para centrar la imagen si es necesario */
    align-items: center;
    justify-content: center;
    padding: 15px; /* Un poco más de padding para que la imagen respire */
    box-sizing: border-box; /* Incluye padding en el cálculo del height */
}

.product-image { /* Renombrado de .product-card img a .product-image */
    width: 100%;
    height: 100%; /* Ocupa el 100% del wrapper */
    object-fit: contain; /* Asegura que la imagen se vea completa sin deformarse */
}

.product-info {
    width: 100%;
    flex-grow: 1; /* Permite que esta sección crezca para llenar el espacio vertical restante */
    padding: 0 15px 15px; /* Padding ajustado (sin padding superior) */
    box-sizing: border-box; /* Incluye padding en el cálculo del height */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribuye el contenido verticalmente */
}

.product-info h3 {
    font-size: 14px; /* Ajustamos el tamaño para el espacio limitado */
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap; /* Evita que el nombre se rompa en varias líneas */
    overflow: hidden; /* Oculta el texto que se desborda */
    text-overflow: ellipsis; /* Añade puntos suspensivos si el texto es muy largo */
}

.product-info .rating {
    font-size: 12px;
    color: var(--text-medium);
    display: none; /* Ocultamos el rating para mantener la descripción mínima */
}

.product-info .rating i {
    color: var(--primary-color);
}

.product-info .price {
    font-size: 14px;
    color: var(--text-light);
    text-decoration: line-through;
    margin-top: 0; /* Ajuste de margen */
    display: none; /* Ocultamos el precio original para mantener la descripción mínima */
}

.product-info .offer-price {
    font-size: 16px; /* Ajustamos el tamaño del precio de oferta */
    font-weight: 700;
    color: var(--text-dark);
}

.product-info .discount {
    color: var(--success-color);
    font-size: 12px;
    font-weight: 500;
    display: none; /* Ocultamos el descuento para mantener la descripción mínima */
}

.product-info .installments,
.product-info .shipping {
    font-size: 12px; /* Ajustamos el tamaño de las cuotas/envío */
    color: var(--text-medium);
    margin-top: 0; /* Ajuste de margen */
    display: none; /* Ocultamos las cuotas/envío para mantener la descripción mínima */
}

.product-short-description {
    font-size: 12px;
    color: var(--text-medium);
    line-height: 1.3;
    margin-top: auto; /* Empuja la descripción hacia abajo si hay espacio */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limita a 2 líneas */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.favorite-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    position: absolute;
    /* Ajustamos la posición para que quede dentro de la imagen */
    top: 20px; /* Un poco más abajo para no chocar con el borde */
    right: 20px; /* Un poco más a la izquierda para no chocar con el borde */
    z-index: 5; /* Asegura que esté por encima de la imagen y el enlace */
}

.heart-icon {
    font-size: 24px;
    color: var(--text-on-dark-bg);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); /* Sombra más definida para que resalte */
    transition: color 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.favorite-btn:hover .heart-icon {
    transform: scale(1.1);
}

.favorite-btn.favorited .heart-icon {
    color: var(--danger-color); /* Rojo para indicar que es favorito */
    text-shadow: none; /* Quitamos la sombra para que el color sea sólido */
}

/* Barra de Navegación Inferior */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: var(--bg-light);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    color: var(--text-medium);
    text-decoration: none;
}

.bottom-nav .nav-item i {
    font-size: 24px;
    margin-bottom: 3px;
}

.bottom-nav .nav-item.active {
    color: var(--primary-color);
}

/* --- Overlay y Menú Lateral --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    z-index: 1000;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 80vw; /* Ancho flexible basado en el tamaño de la pantalla */
    max-width: 300px; /* Pero con un límite para no ser demasiado grande */
    height: 100%;
    background-color: var(--bg-light);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    z-index: 1001; /* Por encima del overlay */
    display: flex;
    flex-direction: column;
    transform: translateX(-100%); /* Oculto fuera de la pantalla por defecto */
    transition: transform 0.3s ease-in-out;
}

.side-menu.open {
    transform: translateX(0); /* Se desliza a la vista */
}

.close-menu-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-dark);
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.menu-header {
    background-color: var(--primary-color);
    padding: 20px;
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

.user-icon {
    border-radius: 50%;
    background-color: var(--bg-light);
}

.login-prompt {
    font-size: 14px;
    display: none; /* Ocultamos el prompt original, ya que lo pusimos en el HTML */
}

.login-button {
    background-color: var(--facebook-color); /* Un color de botón de ejemplo */
    color: var(--text-on-dark-bg);
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    margin-top: 10px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}

.menu-list {
    list-style: none;
    padding: 20px 0;
    overflow-y: auto; /* Permite scroll si hay muchos items */
}

.menu-list li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 16px;
    border-bottom: 1px solid var(--border-color-light);
}

.menu-list li a:hover {
    background-color: var(--bg-medium);
}

/* Estilos para la sección de favoritos en el menú lateral */
.favorites-section {
    padding: 0 15px 20px 15px;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.favorites-title {
    font-size: 16px;
    font-weight: 700;
    margin: 15px 0;
    color: var(--text-dark);
}

.favorites-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.favorite-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.favorite-item-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    flex-shrink: 0; /* Evita que la imagen se encoja */
}

.favorite-item-info h5 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Añade '...' si el texto es muy largo */
    margin-bottom: 4px;
    font-weight: 500;
}

/* --- Responsive Design para pantallas más grandes --- */

/* Tablets (ej. iPads en modo retrato) y superiores */
@media (min-width: 768px) {
    .main-content { /* Adjust max-width for larger screens */
        max-width: 960px;
        margin-left: auto;
        margin-right: auto;
    }

    .product-list {
        grid-template-columns: repeat(3, 1fr); /* 3 columnas en tablet */
        gap: 15px; /* Keep consistent gap */
    }

    .bottom-nav {
        display: none; /* La navegación inferior no es común en tablets/desktop */
    }
}

/* Desktops y pantallas más anchas */
@media (min-width: 1024px) {
    .product-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* Allow more columns if screen is wide enough */
    }
}

/* --- Estilos para la Página de Detalle de Producto --- */

.product-detail-title {
    font-size: 16px;
    font-weight: 500;
    flex-grow: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}

#product-detail-content {
    padding: 10px;
    padding-bottom: 90px; /* Espacio para la barra de acciones inferior */
}
.main-content .empty-cart-message {
    padding: 40px 20px;
}

/* Contenedor principal que envuelve galería e info */
.product-detail-container {
    background-color: var(--bg-light);
    border-radius: var(--border-radius-lg);
    overflow: hidden; /* Para que el radio se aplique a las imágenes */
}

/* --- Estilos de la Galería --- */
.product-gallery {
    margin-bottom: 16px;
}

.main-image-container img {
    width: 100%;
    display: block;
}

.thumbnail-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 1 principal + 4 adicionales */
    gap: 8px;
    padding: 0 10px 10px 10px;
}

.thumbnail-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--border-radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.thumbnail-image:hover {
    border-color: var(--border-color);
}

.thumbnail-image.active {
    border-color: var(--primary-color);
}

/* --- Estilos de la Información del Producto --- */
.pdp-info {
    padding: 20px 15px;
}

.pdp-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.pdp-installments {
    font-size: 14px;
    font-weight: 500;
    color: var(--success-color);
    margin-bottom: 15px;
}

.pdp-description, .pdp-specs {
    margin-top: 20px;
}

.pdp-description h3, .pdp-specs h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color-light);
}

.pdp-description p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-medium);
}

.pdp-specs ul {
    list-style: none;
    padding: 0;
    font-size: 14px;
    color: var(--text-medium);
}

.pdp-specs li {
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color-light);
}
.pdp-specs li:last-child {
    border-bottom: none;
}

.pdp-specs li strong {
    color: var(--text-dark);
    font-weight: 500;
    margin-right: 10px; /* Usamos margen para espaciar elementos hermanos */
}

.pdp-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background-color: var(--bg-light);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.add-to-cart-btn {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-on-dark-bg);
    background-color: var(--secondary-color); /* Color de ejemplo */
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s ease-in-out;
    text-decoration: none; /* Para que los enlaces no tengan subrayado */
}

.add-to-cart-btn:hover {
    background-color: #2980b9; /* Un azul un poco más oscuro al pasar el mouse */
}

.add-to-cart-btn.added {
    background-color: var(--success-color); /* Verde de éxito */
    cursor: default;
}

/* Estilo para el botón cuando es un enlace para ver el carrito */
.view-cart-btn {
    background-color: var(--text-dark); /* Un color oscuro para diferenciar la acción */
}

/* --- Estilos para la Página del Carrito --- */

.cart-page-title {
    font-size: 18px;
    font-weight: 500;
    flex-grow: 1;
    text-align: center;
}

.header-icon-placeholder {
    width: 20px; /* Mismo tamaño que el botón de volver para centrar el título */
}

#cart-items-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-item {
    background-color: var(--bg-light);
    border-radius: var(--border-radius-md);
    padding: 15px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    flex-shrink: 0;
}

.cart-item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cart-item-details h3 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.cart-item-price {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
}

.quantity-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    color: var(--secondary-color);
}

.quantity-value {
    padding: 0 10px;
    font-size: 14px;
    font-weight: 500;
}

.remove-from-cart-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

.cart-summary-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--bg-light);
    padding: 15px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 18px;
}

.total-price {
    font-weight: 700;
}

.checkout-btn,
.place-order-btn {
    display: block; /* Asegura que el <a> ocupe todo el ancho */
    box-sizing: border-box; /* Incluye padding en el width */
    width: 100%;
    padding: 15px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-on-dark-bg);
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    text-align: center;
    text-decoration: none; /* No afecta a los botones, solo a los <a> */
    transition: background-color 0.2s ease-in-out;
}

.checkout-btn {
    background-color: var(--secondary-color);
}
.place-order-btn {
    background-color: var(--success-color); /* Verde para finalizar */
}

.empty-cart-message {
    text-align: center;
    padding: 40px 20px;
}

.empty-cart-message h2 {
    margin-bottom: 10px;
}

.empty-cart-message p {
    color: var(--text-medium);
    margin-bottom: 20px;
}

.start-shopping-btn {
    display: inline-block;
    padding: 12px 25px;
    background-color: var(--text-dark);
    color: var(--text-on-dark-bg);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-weight: 500;
}

/* --- Estilos para la Página de Checkout --- */

.checkout-page-title {
    font-size: 18px;
    font-weight: 500;
    flex-grow: 1;
    text-align: center;
}

.checkout-section {
    background-color: var(--bg-light);
    padding: 20px 15px;
    border-radius: var(--border-radius-md);
    margin-bottom: 15px;
}

.checkout-section h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.checkout-form .form-group {
    margin-bottom: 15px;
}

.checkout-form label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
}

.checkout-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 16px;
}

#checkout-summary-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.checkout-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.checkout-summary-item .item-name {
    color: var(--text-medium);
}

.checkout-summary-item .item-price {
    font-weight: 500;
}

.checkout-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    padding-top: 15px;
    border-top: 1px solid var(--border-color-light);
}

/* Ajuste para páginas con pie de página fijo (Checkout) */
.body-with-fixed-footer .main-content {
    padding-bottom: 100px; /* Espacio extra para el botón de "Realizar Pedido" */
}

/* --- Botón de Chat Flotante (FAB) --- */
.chat-fab {
    position: fixed;
    /* Aumentamos la distancia inferior para evitar solapamiento con los pies de página fijos más altos (ej. resumen del carrito) */
    bottom: 140px; 
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--success-color); /* Un color que invita a la acción */
    color: var(--text-on-dark-bg);
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999; /* Asegura que esté por encima de otros elementos */
    transition: transform 0.2s ease-in-out;
}

.chat-fab:hover {
    transform: scale(1.1); /* Pequeña animación al pasar el mouse */
}

/* --- Ventana de Chat --- */
.chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 90vw;
    max-width: 350px;
    height: 70vh;
    max-height: 500px;
    background-color: var(--bg-light);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    z-index: 1000; /* Por encima del chat-fab */
    
    /* Oculto por defecto con transform y opacity para una transición suave */
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
}

.chat-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.chat-header {
    /* Un look más profesional con un gradiente sutil */
    background: linear-gradient(135deg, var(--secondary-color), #2c3e50);
    color: var(--text-on-dark-bg);
    padding: 12px 15px;
    border-top-left-radius: var(--border-radius-lg);
    border-top-right-radius: var(--border-radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Asegura que la imagen sea perfectamente redonda */
    object-fit: cover;
    /* Quitamos el borde para un look más limpio */
}

.agent-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.agent-status-text {
    font-size: 13px;
    color: #2ecc71; /* Color verde brillante para "En línea", como en WhatsApp */
    display: block;
    font-weight: 500;
}

.close-chat-btn {
    background: none;
    border: none;
    color: var(--text-on-dark-bg);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.chat-body {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: var(--bg-page);
    display: flex;
    flex-direction: column;
    gap: 12px; /* Espacio entre mensajes */
}

.chat-message {
    display: flex;
    flex-direction: column;
}

.message-bubble {
    padding: 10px 15px;
    border-radius: var(--border-radius-lg);
    line-height: 1.4;
    font-size: 14px;
    max-width: 80%;
}

.message-bubble p {
    margin: 0;
    padding: 0;
    background: none;
    display: block;
    color: inherit;
}

.chat-timestamp {
    display: block;
    font-size: 11px;
    margin-top: 5px;
    text-align: right;
    opacity: 0.7;
}

.chat-message.received .chat-timestamp {
    color: var(--text-light);
}

/* Estilos para el indicador de "escribiendo..." */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 0;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #ccc;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    /* Animación de rebote */
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    } 40% {
        transform: scale(1.0);
    }
}

.chat-message.received {
    align-items: flex-start;
}

.chat-message.received .message-bubble {
    background-color: var(--bg-light);
    color: var(--text-dark);
    border-bottom-left-radius: var(--border-radius-sm); /* Efecto "cola" */
}

.chat-message.sent {
    align-items: flex-end;
}

.chat-message.sent .message-bubble {
    background-color: var(--secondary-color);
    color: var(--text-on-dark-bg);
    border-bottom-right-radius: var(--border-radius-sm); /* Efecto "cola" */
}

.chat-message.sent .chat-timestamp {
    color: rgba(255, 255, 255, 0.8);
}

.chat-footer {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid var(--border-color-light);
    background-color: var(--bg-light);
}

.chat-footer input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-pill);
    padding: 8px 15px;
    font-size: 14px;
    outline: none;
}

.chat-footer button {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0 5px;
}