:root {
    --bg-light: #f4f6f8;
    --card-bg: #ffffff;
    --text-dark: #2c3e50;
    --primary: #0062ff;
    --primary-gradient: #00c6ff;
    --header-bg: #ffffff;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Para empujar el footer abajo */
}

/* =========================================
   HEADER RESPONSIVE (Estilo Fútbol)
   ========================================= */

.main-header {
    background: var(--header-bg);
    padding: 10px 5%;
    /* Padding cómodo */
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;

    /* MAGIA AQUÍ: Permitir que los elementos bajen en celular */
    flex-wrap: wrap;
    gap: 15px;
    /* Espacio entre elementos */
}

/* 1. LOGO (Izquierda) */
.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    /* Evita que el logo se aplaste */
}

.header-logo-img {
    height: 50px;
    width: auto;
}

.logo-text {
    font-family: 'Bangers', cursive;
    font-size: 1.8rem;
    letter-spacing: 1px;
    color: var(--text-dark);
    line-height: 1;
}

.highlight {
    color: var(--primary);
}

/* 2. BUSCADOR (Centro en PC / Abajo en Móvil) */
.search-container {
    flex-grow: 1;
    /* Ocupa el espacio sobrante en PC */
    margin: 0 20px;
    position: relative;
    max-width: 500px;
}

#searchInput {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: #f1f2f6;
    transition: 0.3s;
    outline: none;
}

#searchInput:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 5px rgba(0, 98, 255, 0.2);
}

#searchBtn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
}

/* 3. ICONOS / CARRITO (Derecha) */
.header-icons {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    /* Evita que se aplaste */
}

.cart-trigger {
    position: relative;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-dark);
    transition: 0.3s;
}

.cart-trigger:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 50%;
}

/* --- VERSIÓN MÓVIL HEADER (Layout Ajustado) --- */
@media (max-width: 768px) {
    .main-header {
        padding: 10px 5%;
        gap: 10px;
        /* Menos espacio entre filas */
    }

    .logo-text {
        font-size: 1.4rem;
    }

    /* Logo un poco más chico */
    .header-logo-img {
        height: 40px;
    }

    /* EL BUSCADOR BAJA A LA SEGUNDA LÍNEA */
    .search-container {
        order: 3;
        /* Lo mandamos al final (abajo) */
        width: 100%;
        /* Que ocupe todo el ancho */
        max-width: 100%;
        margin: 5px 0 0 0;
        /* Un poco de margen arriba */
    }
}

/* =========================================
   SECCIONES PRINCIPALES
   ========================================= */

/* Banner */
.hero-banner {
    background: linear-gradient(135deg, var(--primary), var(--primary-gradient));
    color: white;
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 20px;
}

.banner-content h2 {
    font-family: 'Bangers', cursive;
    font-size: 2rem;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.contact-btn {
    background: white;
    color: var(--primary);
    padding: 10px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: 0.3s;
    display: inline-block;
}

.contact-btn:hover {
    transform: scale(1.05);
}

/* Filtros Categorías */
.category-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-btn {
    background: white;
    border: 1px solid #ddd;
    color: var(--text-dark);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--text-dark);
    color: white;
    transform: translateY(-2px);
}

/* Grid de Productos */
main {
    flex: 1;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    padding: 20px 5%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Tarjeta de Producto */
.product-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s;
    border: 1px solid #eee;
    box-shadow: var(--shadow);
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

/* Contenedor de imagen (con efecto hover doble) */
.img-container {
    height: 260px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: #fff;
    overflow: hidden;
}

.img-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: opacity 0.4s ease;
    position: absolute;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.1));
}

/* Animación Hover Imagen */
.img-container .img-back {
    opacity: 0;
}

.product-card:hover .img-front {
    opacity: 0;
}

.product-card:hover .img-back {
    opacity: 1;
}

.discount-tag {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    font-weight: bold;
    font-size: 0.8rem;
    border-radius: 4px;
    z-index: 10;
}

.info {
    padding: 20px;
    text-align: center;
}

.info h3 {
    margin-bottom: 5px;
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 600;
    height: 3em;
    overflow: hidden;
}

.delivery {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 10px;
}

.price-wrapper {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.strike {
    text-decoration: line-through;
    color: #aaa;
    font-size: 0.9rem;
    margin-right: 8px;
    font-weight: 400;
}

.add-btn {
    width: 100%;
    padding: 12px;
    background: var(--text-dark);
    border: none;
    color: white;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.add-btn:hover {
    background: var(--primary);
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 40px 0;
}

.page-btn {
    background: white;
    border: 1px solid #ddd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    color: var(--text-dark);
    transition: 0.3s;
}

.page-btn:hover {
    background: #eee;
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
}

/* Footer */
.main-footer {
    background: #1a1a1d;
    color: white;
    padding: 40px 20px;
    text-align: center;
    margin-top: 50px;
}

.footer-content h3 {
    font-family: 'Bangers', cursive;
    font-size: 1.5rem;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.whatsapp-footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #25D366;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 15px;
    transition: 0.3s;
}

.whatsapp-footer-btn:hover {
    background: #1ebc57;
    transform: scale(1.05);
}

.copyright {
    margin-top: 30px;
    font-size: 0.8rem;
    color: #777;
    border-top: 1px solid #333;
    padding-top: 20px;
}

/* Responsive Grid Móvil */
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
        padding: 10px;
    }

    .hero-banner h2 {
        font-size: 1.5rem;
    }
}

/* =========================================
   CARRITO SIDEBAR
   ========================================= */

.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100%;
    background: white;
    z-index: 200;
    padding: 25px;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.1);
    transition: 0.3s;
}

.cart-sidebar.open {
    right: 0;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 150;
    display: none;
    backdrop-filter: blur(2px);
}

.overlay.active {
    display: block;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.cart-header h3 {
    color: var(--primary);
    font-family: 'Bangers', cursive;
    letter-spacing: 1px;
    font-size: 1.5rem;
    margin: 0;
}

.close-cart-btn {
    background: transparent;
    border: none;
    font-size: 1.6rem;
    color: #ccc;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.close-cart-btn:hover {
    color: #ff4444;
    background-color: rgba(255, 68, 68, 0.1);
    transform: rotate(90deg);
}

.cart-items-container {
    flex: 1;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-right: 15px;
}

.qty-controls button {
    background: #eee;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 4px;
    cursor: pointer;
}

.cart-footer {
    padding-top: 15px;
    border-top: 2px solid #f0f0f0;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 20px;
}

.checkout-btn {
    width: 100%;
    background: #25D366;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

/* =========================================
   ESTILOS BASE DEL PANEL ADMIN (Compartidos)
   ========================================= */

/* Nota: admin.html tiene sus propios estilos específicos, 
   pero estos se mantienen por compatibilidad */

.admin-trigger {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: #333;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2000;
    opacity: 0.3;
    transition: 0.3s;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.admin-trigger:hover {
    opacity: 1;
    transform: scale(1.1);
}

.admin-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 3000;
    overflow-y: auto;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.admin-content {
    background: white;
    max-width: 800px;
    margin: 30px auto;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.admin-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.save-btn {
    background: #2ecc71;
    color: white;
    padding: 12px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    border-radius: 5px;
}

.clear-btn {
    background: #95a5a6;
    color: white;
    padding: 12px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    border-radius: 5px;
}

.save-server-btn {
    background: #8e44ad;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(142, 68, 173, 0.4);
    transition: 0.3s;
    width: 100%;
    margin-top: 10px;
}

.save-server-btn:hover {
    background: #732d91;
    transform: scale(1.02);
}

#adminTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#adminTable th {
    background: #333;
    color: white;
    padding: 10px;
    text-align: left;
}

#adminTable td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

#adminTable img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.edit-btn {
    background: #f1c40f;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
}

.del-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    margin-left: 5px;
    border-radius: 4px;
}

@media (max-width: 600px) {
    .admin-form {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   ESTILOS DE LA VENTANA MODAL DE PRODUCTO
   ========================================= */

.product-modal-overlay {
    display: none;
    /* Oculto por defecto */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    padding: 20px;
}

.product-modal-content {
    background: white;
    width: 100%;
    max-width: 900px;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #555;
    z-index: 10;
}

.modal-body {
    display: flex;
    flex-wrap: wrap;
}

/* Galería (Izquierda) */
.modal-gallery {
    flex: 1;
    min-width: 300px;
    background: #f9f9f9;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.main-image-container img {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
}

.thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.thumb {
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    object-fit: contain;
    background: white;
    padding: 5px;
    transition: 0.2s;
}

.thumb:hover,
.thumb.active {
    border-color: var(--primary);
    transform: scale(1.1);
}

/* Info (Derecha) */
.modal-info {
    flex: 1.2;
    padding: 40px;
    display: flex;
    flex-direction: column;
}

.modal-category {
    color: var(--primary);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

#modalTitle {
    font-family: 'Bangers', cursive;
    font-size: 2.5rem;
    line-height: 1.1;
    margin: 10px 0;
    color: var(--text-dark);
}

.modal-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.modal-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #555;
}

.price-large {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 25px;
}

/* Acciones */
.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: auto;
}

.qty-selector {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.qty-selector button {
    background: #f0f0f0;
    border: none;
    padding: 0 15px;
    cursor: pointer;
    font-size: 1.2rem;
}

.qty-selector input {
    width: 40px;
    text-align: center;
    border: none;
    font-weight: bold;
    -moz-appearance: textfield;
}

.add-cart-large {
    flex: 1;
    background: var(--text-dark);
    color: white;
    border: none;
    padding: 15px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 1.1rem;
}

.add-cart-large:hover {
    background: var(--primary);
    transform: translateY(-2px);
}

/* Móvil */
@media (max-width: 768px) {
    .modal-body {
        flex-direction: column;
    }

    .product-modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-gallery {
        padding: 20px;
    }

    .modal-info {
        padding: 20px;
    }

    #modalTitle {
        font-size: 2rem;
    }
}

/* =========================================
   BOTÓN "VER DETALLES" EN TARJETA
   ========================================= */

/* Contenedor de imagen: necesario para posicionar el botón */
.img-container {
    position: relative;
    overflow: hidden;
    /* Para que el botón salga de abajo */
}

/* El botón flotante oculto */
.view-details-overlay {
    position: absolute;
    bottom: -50px;
    /* Escondido abajo */
    left: 0;
    width: 100%;
    background: rgba(44, 62, 80, 0.9);
    /* Color oscuro semitransparente */
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: bold;
    font-size: 0.9rem;
    transition: 0.3s ease-out;
    opacity: 0;
    pointer-events: none;
    /* Para no interferir con el clic de la imagen */
}

/* Al pasar el mouse por la tarjeta, sube el botón */
.product-card:hover .view-details-overlay {
    bottom: 0;
    opacity: 1;
}

/* En móviles, que siempre se vea un poco o usar un icono */
@media (max-width: 768px) {
    .view-details-overlay {
        bottom: 0;
        opacity: 1;
        background: rgba(44, 62, 80, 0.7);
        padding: 5px;
        font-size: 0.8rem;
    }
}