body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-size: 16px;
    line-height: 1.6;
    color: #2e0c4c;
    background-color: #f9f9f9;
}

/* Estilos del HEADER */
.navbar {
    background-color: #ffe500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 0.8rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.6s ease-in-out;
    height: 60px;
}

/* Animación */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo */
.logo img {
    height: 100px;
    cursor: pointer;
}

.logo img:hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

/* Búsqueda */
.acciones {
    display: flex;
    align-items: center;
    background-color: white;
    border-radius: 25px;
    padding: 0.3rem 1rem;
    width: 100%;
    max-width: 450px;
    transition: box-shadow 0.3s ease;
}

.acciones:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.acciones i {
    color: #2e0c4c;
    margin-right: 0.5rem;
}

.acciones input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 1rem;
}

/* Navegación */
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: #2e0c4c;
    font-weight: bold;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: transform 0.3s ease;
}

.nav-links a:hover {
    transform: translateY(-3px);
}

/* Carrito */
.cart {
    background-color: white;
    border: none;
    border-radius: 25px;
    padding: 0.4rem 0.8rem;
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.cart:hover {
    background-color: #f1f1f1;
    transform: scale(1.05);
}

.cart i {
    color: #2e0c4c;
    font-size: 20px;
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #2e0c4c;
    color: white;
    font-size: 12px;
    border-radius: 50%;
    padding: 2px 6px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: #2e0c4c;
  cursor: pointer;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
    margin-left: auto;
  }

  .nav-links {
    display: none;
  }

  .mobile-menu {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background: #ffe500;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
  }

  .mobile-menu.hidden {
    display: none;
  }

  .mobile-menu a {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2e0c4c;
    text-decoration: none;
  }
}



.dropdown {
    position: relative;
    display: inline-block;
    margin-right: 1.5rem;
}

.dropdown-toggle {
    text-decoration: none;
    color: #2e0c4c;
    font-weight: bold;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: transform 0.3s ease;
    padding: 0.5rem 0;
}

.dropdown-toggle:hover {
    transform: translateY(-3px);
}

.dropdown-arrow {
    margin-left: 0.3rem;
    transition: transform 0.2s ease;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 101;
    border-radius: 5px;
    overflow: hidden;
    top: 100%;
    left: 0;
    margin-top: 5px;
}

.dropdown-menu a {
    color: #2e0c4c;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-weight: normal;
    transition: background-color 0.2s ease;
}

.dropdown-menu a:hover {
    background-color: #f1f1f1;
    transform: none;
}

.dropdown-menu form {
    margin: 0;
}

.dropdown-menu button[type="submit"] {
    background: none;
    border: none;
    color: #2e0c4c;
    padding: 12px 16px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: normal;
    transition: background-color 0.2s ease;
}

.dropdown-menu button[type="submit"]:hover {
    background-color: #f1f1f1;
}

.dropdown-menu.show {
    display: block;
}

.nav-links a.active-link {
    border-bottom: 3px solid #c00000;
    padding-bottom: 3px;
}

.dropdown.show .dropdown-arrow {
    transform: rotate(180deg);
}

/* Categorias */
.categorias-menu {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    padding: 2rem 1rem;
    background-color: #ffffff;
    flex-wrap: wrap;
}

/* --- Carrito Desplegable --- */
.cart-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 102;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cart-dropdown.show-cart {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.cart-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    background-color: #f9f9f9;
    position: sticky;
    top: 0;
    z-index: 10;
}

.cart-dropdown-header h3 {
    margin: 0;
    color: #2e0c4c;
    font-size: 1.1rem;
}

.close-cart-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.close-cart-btn:hover {
    color: #2e0c4c;
}

.cart-dropdown-items {
    padding: 1rem;
}

.empty-cart-message {
    text-align: center;
    color: #666;
    padding: 2rem;
    font-style: italic;
}

/* --- Estilos para los ítems del carrito con controles de cantidad y eliminar --- */
.cart-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed #eee;
    position: relative; /* Para posicionar el botón de eliminar */
}

.cart-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.cart-item .item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cart-item .item-name {
    font-weight: bold;
    color: #2e0c4c;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.cart-item .item-quantity {
    /* Puedes ocultar este si el span con los botones lo reemplaza */
    font-size: 0.85rem;
    color: #666;
    display: none; /* Ahora la cantidad se mostrará en el span dentro de item-quantity-controls */
}

.cart-item .item-price {
    font-weight: bold;
    color: #c00000;
    font-size: 0.95rem;
    text-align: right;
    margin-top: 0.2rem;
}

/* Estilos para los controles de cantidad */
.item-quantity-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: #f0f0f0;
    border-radius: 4px;
    padding: 2px 5px;
    width: fit-content;
}

.item-quantity-controls .quantity-btn {
    background-color: #2e0c4c;
    color: white;
    border: none;
    border-radius: 3px;
    width: 25px;
    height: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.item-quantity-controls .quantity-btn:hover {
    background-color: #4b1a77;
}

.item-quantity-controls .item-quantity {
    /* Esta es la cantidad mostrada entre los botones */
    font-size: 0.9rem;
    font-weight: bold;
    color: #2e0c4c;
    margin: 0 5px;
    display: inline-block;
}

/* Estilos para el botón de eliminar */
.remove-item-btn {
    background: none;
    border: none;
    color: #c00000;
    font-size: 1.5rem;
    cursor: pointer;
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.remove-item-btn:hover {
    color: #ff0000;
}

/* Fin de estilos de ítems del carrito */

.cart-dropdown-footer {
    padding: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9f9f9;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.cart-dropdown-footer .total-label {
    font-weight: bold;
    color: #2e0c4c;
}

.cart-dropdown-footer .total-price {
    font-weight: bold;
    color: #c00000;
    font-size: 1.2rem;
}

.cart-dropdown-footer .btn-checkout {
    background-color: #2e0c4c;
    color: white;
    padding: 0.7rem 1.2rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.cart-dropdown-footer .btn-checkout:hover {
    background-color: #4b1a77;
    transform: none;
}

.acciones {
    position: relative; /* Importante para el posicionamiento del dropdown */
}

.search-results-dropdown {
    position: absolute;
    top: 100%; /* Debajo del input */
    left: 0;
    width: 100%;
    background-color: white;
    border: 1px solid #ccc;
    border-top: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000; /* Asegura que esté por encima de otros elementos */
    max-height: 300px; /* Limita la altura y añade scroll */
    overflow-y: auto;
    display: none; /* Oculto por defecto */
}

.search-results-dropdown.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #f9f9f9;
}

.search-result-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    margin-right: 10px;
    border-radius: 4px;
}

.search-result-item .details {
    flex-grow: 1;
}

.search-result-item .details h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: #333;
}

.search-result-item .details p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

.search-result-item .actions {
    display: flex;
    gap: 5px;
}

.search-result-item .actions .btn-add-to-cart-search,
.search-result-item .actions .btn-view-details {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.search-result-item .actions .btn-add-to-cart-search {
    background-color: #28a745;
    color: white;
}

.search-result-item .actions .btn-view-details {
    background-color: #007bff;
    color: white;
}

.search-result-item .actions .btn-add-to-cart-search:hover {
    background-color: #218838;
}

.search-result-item .actions .btn-view-details:hover {
    background-color: #0056b3;
}

/* Estilo para cuando no hay resultados */
.search-results-dropdown p.no-results {
    padding: 10px;
    text-align: center;
    color: #888;
}

.delivery-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding: 10px 15px; /* Ajustado para que coincida con tu padding de .dropdown-menu a */
    margin-bottom: 15px;
    background-color: #f9f9f9; /* Fondo ligero para el header del dropdown */
    border-top-left-radius: 8px; /* Para que coincida con el border-radius del .dropdown-menu */
    border-top-right-radius: 8px;
}

.delivery-dropdown-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2em;
}

.close-delivery-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
    padding: 0; /* Asegura que no tenga padding adicional */
    line-height: 1; /* Alinea el carácter 'x' */
}

.close-delivery-btn:hover {
    color: #333;
}

.delivery-dropdown-content {
    padding: 0 15px 15px 15px; /* Ajusta el padding para que el contenido no pegue a los bordes */
}

.delivery-dropdown-content p {
    margin-bottom: 8px;
    color: #555;
    font-size: 0.95em;
}

.delivery-dropdown-content p i {
    margin-right: 5px;
    color: #007bff; /* Un color para los iconos informativos, puedes usar #2e0c4c si prefieres */
}

.delivery-dropdown-content strong {
    color: #333;
}

.btn-manage-address,
.btn-login-to-add-address 
{
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #007bff; /* Azul, puedes usar #2e0c4c si va más con tu paleta */
    color: white;
    border: none;
    border-radius: 5px;
    text-align: center;
    cursor: pointer;
    text-decoration: none; /* Para el <a> */
    font-size: 1em;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}

.btn-manage-address:hover,
.btn-login-to-add-address:hover {
    background-color: #0056b3; /* Tono más oscuro al pasar el mouse */
}

.delivery-info-section,
.delivery-policies-section {
    margin-top: 15px;
    padding-top: 15px;
}

.delivery-info-section h4,
.delivery-policies-section h4 {
    color: #333; /* O #2e0c4c */
    font-size: 1.1em;
    margin-bottom: 10px;
    border-bottom: 1px dashed #eee;
    padding-bottom: 5px;
}

.delivery-price {
    font-weight: bold;
    color: #28a745; /* Un verde para el precio, o tu color principal si prefieres */
    font-size: 1.1em;
}

.small-text {
    font-size: 0.85em;
    color: #777;
}

hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

.btn-full-delivery-info {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: #007bff; /* O #2e0c4c */
    text-decoration: none;
    font-size: 0.9em;
}

.btn-full-delivery-info:hover {
    text-decoration: underline;
}

/* Modificaciones específicas para el dropdown de delivery para que se vea como los demás */
/* Dado que usamos .dropdown-menu, ya tendrá display: none; y el resto de la base */
/* Lo importante es que el JS añada/quite la clase 'show' para mostrarlo */
.dropdown-menu#deliveryDropdownMenu {
    /* Si quieres un ancho diferente al del dropdown de usuario */
    min-width: 320px;
    max-width: 400px;
    /* Ajusta la posición si es necesario, pero top: 100%; left: 0; ya debería funcionar bien */
    /* top: 100%; /* Ajustado para que aparezca justo debajo del toggle */
    /* left: 50%; */
    /* transform: translateX(-50%); */ /* Si quieres que esté centrado bajo el enlace */
}

/* Media Queries para Responsividad */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        justify-content: space-between;
        height: auto;
        gap: 1rem;
    }

    .logo img {
        height: 70px;
    }

    .acciones {
        order: 3;
        width: 100%;
        max-width: none;
        margin-bottom: 10px;
    }

    .menu-toggle {
        display: block;
        order: 2;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: #ffe500;
        padding: 1rem 0;
        border-top: 1px solid #ccc;
        gap: 0.5rem;
        order: 4;
    }

    .nav-links a,
    .nav-links .cart {
        padding: 0.8rem 1.5rem;
        width: 100%;
        justify-content: flex-start;
        border-top: 1px solid #e0e0e0;
    }

    .nav-links.active {
        display: flex;
    }

    .dropdown {
        width: 100%;
        margin-right: 0;
        border-top: 1px solid #e0e0e0;
        padding: 0.8rem 1.5rem;
    }

    .dropdown-toggle {
        width: 100%;
        justify-content: flex-start;
        padding: 0;
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        margin-top: 0;
        border-top: 1px solid #e0e0e0;
    }

    .dropdown-menu a,
    .dropdown-menu button {
        padding-left: 2.5rem;
        border-top: none;
    }

    .dropdown.show .dropdown-arrow {
        transform: rotate(180deg);
    }

    /* Ajustes específicos para el carrito en móvil */
    .cart {
        padding: 0.8rem 1.5rem;
        justify-content: flex-start;
        width: 100%;
        border-radius: 0;
        background-color: transparent;
        border-bottom: 1px solid #e0e0e0;
        margin-top: 0;
        position: static;
    }

    .cart:hover {
        background-color: #f1f1f1;
        transform: none;
    }

    .cart-count {
        position: static;
        margin-left: auto;
        margin-right: 0;
        top: auto;
        right: auto;
        background-color: #c00000;
    }

    .cart-dropdown {
        position: static;
        width: 100%;
        max-height: none;
        box-shadow: none;
        border-radius: 0;
        border-top: 1px solid #e0e0e0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        transform: none;
        padding: 0;
    }

    .cart-dropdown-header,
    .cart-dropdown-footer {
        position: static;
        background-color: #ffe500;
    }

    .cart-dropdown-items {
        padding: 0.5rem 1rem;
    }

    .cart-item {
        padding: 0.5rem 0;
        margin-bottom: 0.5rem;
        flex-wrap: wrap; /* Permite que los elementos se envuelvan */
        justify-content: space-between; /* Distribuye espacio */
    }

    .cart-item img {
        width: 50px;
        height: 50px;
        margin-right: 10px; /* Pequeño margen a la derecha de la imagen */
    }

    .cart-item .item-details {
        flex-basis: calc(
            100% - 70px
        ); /* Ocupa el resto del espacio junto a la imagen */
        align-items: flex-start;
    }

    .item-quantity-controls {
        order: 3; /* Asegura que los controles de cantidad vayan debajo de los detalles principales */
        margin-top: 5px;
    }

    .cart-item .item-price {
        order: 4; /* El precio también puede ir en una nueva línea o ajustarse */
        width: 100%; /* Ocupa todo el ancho si va debajo */
        text-align: left; /* Alinea a la izquierda en móvil */
    }

    .remove-item-btn {
        position: static; /* Ocupa el flujo normal en móvil */
        align-self: flex-start; /* Alinea arriba */
        margin-left: auto; /* Empuja a la derecha */
    }

    .cart-dropdown.show-cart {
        display: block;
        opacity: 1;
    }
}

.remove-promo-btn{
    background: none;
    border: none;
    color: #c00000;
    font-size: 1.5rem;
    cursor: pointer;
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.remove-promo-btn:hover{
    color: #ff0000;
}

.quantity-btn-promo{
    background-color: #2e0c4c;
    color: white;
    border: none;
    border-radius: 3px;
    width: 25px;
    height: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.quantity-btn-promo:hover{
    background-color: #4b1a77;
}
