/* Reseteo básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Estilo del header */
header {
    background: linear-gradient(90deg, #182848, #4665af);
    padding: 15px 25px;
}

.header-container {
    display: flex;
    justify-content: space-between;
    /* Espacio entre los elementos */
    align-items: center;
    /* Centrado vertical */
}

header h1 {
    font-size: 24px;
    font-weight: bold;
}

#search-form {
    position: relative;
}

#search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 80%;
    background: #e4e4e4;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.suggestion-item:hover {
    background-color: #f4f7fc;
}

#logo {
    height: 60px;
    /* Ajusta la altura del logo según lo necesites */
    width: 150px;
    /* Mantener la proporción del logo */
}

#search-form {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    /* El formulario ocupa el espacio restante */
}

#search {
    width: 80%;
    /* Ajusta el tamaño del campo de búsqueda */
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

#search-btn {
    background-color: #4260a5;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: 10px;
}

#search-btn i {
    font-size: 25px;
    /* Tamaño de la lupa */
    color: #fdfdfd;
    /* Color de la lupa */
}

#cart-icon img {
    width: 30px;
    height: 30px;
    cursor: pointer;
}

/* Estilo para el main y la sección de productos */
main {
    margin-top: 15px;
    /* Separar el contenido principal del header */
    padding: 10px;
    /* Agregar algo de espacio alrededor del contenido */
}

#productos {
    margin-top: 20px;
    /* Separar el título de la lista de productos */
}

#productos h2 {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
}

#product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    /* Layout de productos */
    gap: 20px;
    /* Espacio entre productos */
}

.category-card {
    flex: 0 0 auto;
    margin-right: 20px;
    width: 250px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    /* Necesario para posicionar el texto encima de la imagen */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Imagen de la categoría */
.category-card img {
    width: 100%;
    height: 200px;
    /* Ajusta la altura de la imagen */
    object-fit: cover;
    /* Asegura que la imagen se recorte adecuadamente */
}

/* Nombre de la categoría */
.category-card h3 {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    /* Color blanco para que se vea bien sobre el fondo oscuro */
    margin: 0;
    padding: 10px;
    position: absolute;
    bottom: 0;
    /* Coloca el texto al fondo de la tarjeta */
    width: 100%;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.6);
    /* Fondo negro con transparencia */
}

/* Efecto hover para las tarjetas */
.category-card:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* Asegúrate de que el contenedor del carrusel tenga un buen comportamiento de desplazamiento */
.carousel-container {
    width: 100%;
    margin-top: 20px;
    position: relative;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    /* OK aquí */
}

/* Contenedor de las tarjetas */
#category-cards {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    /* ✔ permite scroll */
    scroll-behavior: smooth;
    /* ✔ animación */
    padding: 10px;
}

/* Ocultar scrollbar */
#category-cards::-webkit-scrollbar {
    display: none;
}

/* EVITA QUE SE ENCOJAN */
.category-card {
    min-width: 250px;
    flex-shrink: 0;
}

/* Botones de navegación del carrusel */
.carousel-btn {
    position: absolute;
    top: 50%;
    /* Centrado vertical respecto al contenedor */
    transform: translateY(-50%);
    /* Para asegurar que esté perfectamente centrado */
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 30px;
    border: none;
    padding: 12px;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.prev-btn {
    left: 10px;
    /* Alineado a la izquierda */
}

.next-btn {
    right: 10px;
    /* Alineado a la derecha */
}

/* Efecto hover en los botones */
.carousel-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
    /* Efecto de ampliación al pasar el ratón */
}

/* Estilos para la sección de categorías */
#categorias {
    margin-top: 40px;
    /* Separar las categorías del header y otros elementos */
}

#categorias h2 {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

/*#######################################*/
/*Tarjetas de productos */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.product-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .1);
    padding: 15px;
    transition: transform .3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
}

.product-card h3 {
    margin: 10px 0 5px;
}

.precio {
    font-weight: bold;
    color: #0b4cff;
}

/* Botón moderno para agregar al carrito */
.add-to-cart {
    width: 100%;
    padding: 10px 12px;
    background: linear-gradient(135deg, #0b4cff, #4a7dff);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: 0.25s ease;
}

.add-to-cart i {
    font-size: 18px;
}

.add-to-cart:hover {
    background: linear-gradient(135deg, #093dcc, #3e6bdf);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.add-to-cart:active {
    transform: scale(0.97);
}


/* ====== FOOTER ====== */

.footer {
    background: #1a1a1a;
    color: #d4d4d4;
    padding: 40px 20px 20px;
    margin-top: 40px;
}

.footer-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-section h3,
.footer-section h4 {
    color: white;
    margin-bottom: 15px;
}

.footer-section p,
.footer-section a {
    font-size: 14px;
    color: #cfcfcf;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin: 8px 0;
}

.footer-section ul li a {
    text-decoration: none;
    color: #cfcfcf;
    transition: 0.3s;
}

.footer-section ul li a:hover {
    color: #ffffff;
}

/* Redes sociales */
.social-icons a {
    margin-right: 12px;
    font-size: 22px;
    color: #cfcfcf;
    transition: 0.3s;
}

.social-icons a:hover {
    color: #ffffff;
}

/* Línea inferior del footer */
.footer-bottom {
    text-align: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #3a3a3a;
}

.footer-bottom p {
    font-size: 13px;
    color: #9d9d9d;
}

/* ===== CARRITO DESPLEGABLE ===== */

.cart-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 350px;
    height: 100%;
    background: #ffffff;
    box-shadow: -3px 0 10px rgba(0, 0, 0, 0.2);
    transition: 0.4s ease;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.cart-panel.open {
    right: 0;
}

.cart-header {
    padding: 20px;
    background: #a1a1a1;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-cart {
    background: transparent;
    border: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
}

.cart-items {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}

.cart-item-info {
    flex-grow: 1;
    margin-left: 10px;
}

.cart-item-info h4 {
    margin-bottom: 5px;
    font-size: 15px;
}

.cart-footer {
    padding: 15px;
    border-top: 2px solid #eee;
}

.checkout-btn {
    width: 100%;
    padding: 12px;
    background: #0b4cff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    font-size: 16px;
}

.checkout-btn:hover {
    background: #0936b8;
}

.delet-btn {
    width: 100%;
    padding: 12px;
    background: #ff0b0b;
    color: rgb(255, 255, 255);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    font-size: 16px;
}

.delete-btn:hover {
    background: #b80909;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    z-index: 1500;
}

.cart-overlay.show {
    display: block;
}

.cart-item {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.cart-info {
    flex: 1;
}

.cart-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #222;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.qty-btn:hover {
    background: #000;
}



/* ===============================
   MEDIA QUERIES – CELULARES
   =============================== */
@media (max-width: 768px) {

    /* ===== HEADER ===== */
    header {
        padding: 10px 15px;
    }

    .header-container {
        flex-direction: column;
        gap: 10px;
    }

    #logo {
        height: 50px;
        width: auto;
    }

    header h1 {
        font-size: 20px;
        text-align: center;
    }

    #search-form {
        width: 100%;
        flex-grow: unset;
    }

    #search {
        width: 100%;
    }

    #search-suggestions {
        width: 100%;
    }

    #cart-icon img {
        width: 26px;
        height: 26px;
    }

    /* ===== MAIN ===== */
    main {
        padding: 5px;
    }

    /* ===== PRODUCTOS ===== */
    #productos h2,
    #categorias h2 {
        font-size: 20px;
        text-align: center;
    }

    /* ===== GRID DE PRODUCTOS ===== */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-card {
        padding: 12px;
    }

    .product-card img {
        height: 150px;
    }

    .product-card h3 {
        font-size: 14px;
    }

    .precio {
        font-size: 15px;
    }

    /* ===== CATEGORÍAS / CARRUSEL ===== */
    .carousel-container {
        border-radius: 8px;
    }

    #category-cards {
        gap: 10px;
    }

    .category-card {
        width: 180px;
        margin-right: 10px;
    }

    .category-card img {
        height: auto;
        /* Dejar que la imagen ajuste su altura automáticamente */
        max-height: 150px;
    }

    .category-card h3 {
        font-size: 14px;
        padding: 8px;
    }

    /* ===== BOTONES CARRUSEL ===== */
    .carousel-btn {
        font-size: 24px;
        padding: 8px;
    }

    .prev-btn {
        left: 5px;
    }

    .next-btn {
        right: 5px;
    }
}

/* ===== EXTRA PEQUEÑOS (≤480px) ===== */
@media (max-width: 480px) {

    .product-grid {
        grid-template-columns: 1fr;
    }

    .category-card {
        width: 160px;
    }

    header h1 {
        font-size: 18px;
    }
}