/* Estilos generales */
body {
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #1e3a5f;
    transition: all .3s ease;
}

header {
    background-color: #2e8b57;
    color: white;
    padding: 15px;
    text-align: center;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 5px;
}

.logo img {
    width: 120px;
    position: absolute;
    left: 10px;
    top: 35px
}

h1 {
    font-family: 'Poppins', sans-serif;
    margin: 0;
}

/* Contenedor principal (main) */
main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    padding-top: 80px;
    /* Espacio para la barra de búsqueda fija */
}

.search-bar {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.search-bar input {
    width: 80%;
    max-width: 500px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: all .3s ease;
}

.search-bar input:focus {
    border-color: #153f27;
    outline: none;
}

.clear-button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    color: #666;
    height: 40px;
    width: 40px;
    transition: all .3s ease;
    border-radius: 5px;
}

.clear-button:hover {
    background-color: #ff000090;
        
    &:active {
        background-color: #00000020;
        border-radius: 50%;
    }
}

#clear-search .trash-icon {
    fill: #66666650;
}

#open-help {
    position: absolute;
    right: 60px;
    top: 30px;
    width: 50px;
    padding: 0;
    background-color: transparent;
    border: none;
    cursor: pointer;
    transition: all .3s ease;
    border-radius: 5px;

    &:hover {
        background-color: #00000050;
    }
    
    &:active {
        background-color: #00000020;
        border-radius: 50%;
    }
}

/* Lista de productos */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
    flex-grow: 1;
    max-width: calc(100% - 420px);
    /* Ajusta el ancho para dejar espacio al aside */
    margin-top: 80px;
}

.product-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 250px;
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.product-card h2 {
    font-size: 18px;
    margin: 10px 0;
    white-space: wrap;
    /* Evita que el texto pase a la siguiente línea */
    overflow: hidden;
    /* Oculta el texto que se desborda del contenedor */
    text-overflow: ellipsis;
    /* Agrega puntos suspensivos al texto que se corta */
    width: 100%;
    /* Asegura que el contenedor no sea mayor que su contenedor padre */
    display: block;
    /* Asegura que el elemento sea un bloque */
}

.product-card p {
    font-size: 14px;
    color: #666;
    margin: 0px 0;
    flex-grow: 1;
}

.product-card .price {
    font-size: 18px;
    color: #429673;
    font-weight: bold;
    margin: 10px 0;
}

.quantity-container {
    display: flex;
    /* Coloca los elementos en fila */
    align-items: center;
    /* Alinea verticalmente */
    gap: 10px;
    /* Espacio entre el input y el botón */
    justify-content: center;
    /* Centra los elementos dentro del contenedor */
    margin-top: 10px;
}

.product-card .input-cantidad {
    width: 50px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
}

.product-card button {
    background-color: #2e8b57;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    /* Evita que el texto del botón se corte */
    width: 100%;
}

.product-card button:hover {
    background-color: #1e3a5f;
}

/* Carrito de cotización */
.cart {
    position: fixed;
    top: 140px;
    /* Debajo del header y la barra de búsqueda */
    right: 20px;
    width: 400px;
    height: fit-content;
    background-color: white;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 10px;
    border-radius: 10px;
    margin-top: 10px;
}

.cart h2 {
    font-size: 24px;
    margin: 0px;
    text-align: center;
}

.cart .cart-content {
    max-height: 440px;
    overflow-y: auto;
}

.cart ul {
    list-style: none;
    padding: 0;
}

.cart li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    background-color: #f5f5f5;
    padding: 5px;
    border-radius: 5px;
    box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
    padding-right: 40px;
}

.cart li button {
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 2px 5px;
    border-radius: 10px;
    cursor: pointer;
    height: 30px;
    width: 30px;
    position: absolute;
    right: 15px;
    display: none;
}

.cart li:hover button {
    display: block;
}

.cart li button:hover {
    background-color: #ff6b6b50;
        
    &:active {
        background-color: #00000020;
        border-radius: 50%;
    }
}

.cart-total {
    margin-top: 20px;
    font-size: 18px;
}

.cart-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.cart-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#clear-cart {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Espacio entre el ícono y el texto */
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 16px;
}

#clear-cart:hover {
    background-color: #e85c5c;
    /* Color más oscuro al pasar el mouse */
}

/* Estilos del ícono dentro del botón */
#clear-cart .trash-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: white;
    /* Mantiene el color del ícono igual al texto */
    stroke-width: 2;
}

#export-pdf {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Espacio entre el ícono y el texto */
    background-color: #2e8b57;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 16px;
}

#export-pdf:hover {
    background-color: #246f43;
    /* Un verde más oscuro al pasar el mouse */
}

/* Estilos del ícono dentro del botón */
#export-pdf .pdf-icon {
    width: 20px;
    height: 20px;
    fill: white;
    /* Asegura que el ícono sea blanco */
}

.cart-actions button:hover {
    opacity: 0.9;
}

/* Estilos del modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: #fff;
    padding: 10px;
    width: 60%;
    max-width: 800px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
    margin-bottom: 10px;
}

.close {
    color: #aaa;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 20px;
}

.modal-content h2{
    text-align: center;
}

.modal-content ul li{
    list-style: none;
    margin-left: 20px;
}

.titulo-card,
.codigo-card {
    cursor: pointer;
    transition: scale .3s ease;

    &:hover {
        scale: 1.2;
        color: #2c5488
    }
}

/* Ocultar el botón "Ver carrito" por defecto */
.cart-toggle {
    display: none;
}

/* Estilos para los toast */
#toast-container {
    position: fixed;
    z-index: 10999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    backdrop-filter: blur(5px);
    /*     width: 30px;
    height: 30px;
    background-color: red; */
    bottom: 20px;
    left: 20px;
}

/* Estilos del toast */
.toast {
    background-color: #2e8b57CC;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 300px;
    width: 100%;
}

/* Animación para mostrar el toast */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilos para el botón de cerrar toast */
.toast-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    margin-left: auto;
}

/* Estilos para toast de error (remover producto) */
.toast.error {
    background-color: #ff6b6bCC;
}

/* Responsividad */
@media (max-width: 768px) {
    main {
        flex-direction: column;
        justify-content: center;
    }

    header h1 {
        font-size: 1.5em;
    }

    .logo img {
        width: 15%;
    }

    .search-bar input {
        width: 60%;
        max-width: 300px;
        padding: 10px;
        border: 2px solid #ddd;
        border-radius: 5px;
        font-size: 16px;
    }

    .product-grid {
        max-width: 100%;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
    }

    .cart {
        position: relative;
        width: 100%;
        margin-top: 20px;
    }

    /* Mostrar el botón "Ver carrito" solo en mobile */
    .cart-toggle {
        display: block;
        position: fixed;
        bottom: 20px;
        right: 20px;
        background-color: #2e8b57;
        color: white;
        padding: 10px 15px;
        border-radius: 5px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        font-size: 14px;
        cursor: pointer;
        z-index: 2000;
        transition: background-color 0.3s ease;
    }

    .cart-toggle:hover {
        background-color: #246f43;
    }

    /* Ocultar el carrito en mobile por defecto */
    .cart {
        position: fixed;
        right: 0;
        top: 0;
        height: 100%;
        width: 80%;
        background-color: white;
        overflow-y: auto;
        z-index: 1999;
        box-shadow: -5px 0 10px rgba(0, 0, 0, 0.1);
        padding: 20px;
    }

    .hidden {
        display: none;
    }

    #toast-container {
        bottom: 20px;
        left: 20px;
        right: 20px;
        align-items: center;
        backdrop-filter: none;
    }

}

.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #2e8b57;
    color: white;
    font-size: 14px;
    position: fixed;
    bottom: 0;
    width: 100%;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    box-shadow: 0px -5px 10px rgba(0, 0, 0, 0.3);
}

.footer p {
    margin: 5px;
}

.footer #emailContact {
    position: absolute;
    right: 15px;
}