/* ===== RESET Y BASE ===== */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f5f2;
}

/* ===== HEADER ===== */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #f6f8f5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.header-inner {
    max-width: 1600px;
    margin: auto;
    display: flex;
    align-items: center;
    padding: 10px 20px;
}

.header-left {
    flex: 0 0 auto;
}

.header-center {
    flex: 1;
    display: flex;
    max-width: 520px;
    margin: 0 auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px; /* separación real entre carrito y usuario */
}
.logo {
    height: 42px;
}

.header-center input {
    flex: 1;
    padding: 10px;
    border-radius: 20px 0 0 20px;
    border: 1px solid #ccc;
}

.header-center button {
    border: 1px solid #ccc;
    border-left: none;
    padding: 0 16px;
    border-radius: 0 20px 20px 0;
    cursor: pointer;
}

/* ===== LAYOUT PRINCIPAL ===== */
.shop-wrapper {
    max-width: 100% !important;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: start;
    gap: 25px;
}

.filters {
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

.products-area {
    flex: 1;
    min-width: 0;
}

/* ===== FILTROS ===== */
.filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
}

.filter-item img {
    width: 28px;
}

.filter-item.active {
    background: #e5efe0;
    box-shadow: inset 0 0 0 2px #5c7f45;
}

.filter-switch {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 20px;
    cursor: pointer;
}

.slider:before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: .2s;
}

.switch input:checked + .slider {
    background: #5c7f45;
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}

.filters-btn {
    display: none;
    padding: 10px;
    background: #5c7f45;
    color: #fff;
    border: none;
    border-radius: 8px;
}

/* ===== GRID DE PRODUCTOS ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
}

.load-more-wrapper {
    text-align: center;
    margin: 30px 0;
}

.load-more {
    padding: 12px 24px;
    background: #5c7f45;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
    color: #666;
}

/* ===== PRODUCT CARD - VERSIÓN UNIFICADA ===== */
.product-card {
    background: #fff;
    border-radius: 18px;
    padding: 15px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .15);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-height: 420px;
    overflow: visible !important;
    z-index: 1;
}

.product-card:hover {
    transform: translateY(-4px);
    z-index: 100;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.product-card.dropdown-open {
    transform: translateY(-4px);
    z-index: 1000 !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

/* Imagen del producto */
.product-img-wrapper {
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Badges (vegano, sin gluten) */
.badges {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 3;
}

.badge {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

/* Círculo de marca */
.brand-circle {
    position: absolute;
    top: 160px;
    left: 15px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.brand-circle img {
    width: 38px;
}

/* Contenido de la card */
.card-body {
    margin-top: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.price {
    font-weight: bold;
    color: #1b5e20;
    text-align: right;
    font-size: 16px;
    margin: 5px 0;
    flex-shrink: 0;
}

.product-name {
    font-size: 14.5px;
    line-height: 1.3;
    margin: 8px 0;
    flex: 1;
    min-height: 60px;
    max-height: 80px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.product-name strong {
    font-weight: 600;
    color: #222;
}

.product-name .presentation {
    font-weight: 400;
    color: #666;
}

/* ===== CONTROLES DEL CARRITO EN PRODUCTOS ===== */
.btn-cart-container {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    width: 100%;
    position: relative;
    z-index: 10;
    display: flex;
    gap: 8px;
}

/* Botón de agregar */
.btn-add {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: #5c7f45;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    font-size: 14px;
    height: 40px;
}

.btn-add:hover {
    background: #3d5a34;
    transform: translateY(-1px);
}

/* Controles de cantidad */
.quantity-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    height: 40px;
}

.qty-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #333;
    flex-shrink: 0;
}

.qty-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-minus {
    color: #dc3545;
    border-color: #dc3545;
    background: #fff;
}

.qty-minus:hover {
    background: #dc3545;
    color: white;
}

.qty-plus {
    color: #28a745;
    border-color: #28a745;
    background: #fff;
}

.qty-plus:hover {
    background: #28a745;
    color: white;
}

.qty-plus.pulse {
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.qty-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0 12px;
    height: 100%;
    min-width: 0;
}

.qty-input {
    width: 100%;
    border: none;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    background: transparent;
    padding: 0;
    margin: 0;
    min-width: 40px;
    flex: 1;
}

.qty-input:focus {
    outline: none;
    box-shadow: none;
}

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input[type=number] {
    -moz-appearance: textfield;
}

.qty-label {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== DROPDOWN PARA AGREGAR RÁPIDAMENTE ===== */
.quick-add-dropdown {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    z-index: 1000;
}

.dropdown-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #6c757d;
    padding: 0;
}

.dropdown-toggle:hover {
    background: #e9ecef;
    color: #495057;
    border-color: #adb5bd;
}

.dropdown-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
    min-width: 180px;
    z-index: 9999;
    display: none;
    animation: fadeInDown 0.2s ease;
    overflow: hidden;
}

.dropdown-menu.abajo {
    bottom: auto;
    top: 100%;
    margin-top: 10px;
    margin-bottom: 0;
}

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 15px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
    z-index: 10000;
}

.dropdown-menu::after {
    content: '';
    position: absolute;
    bottom: -9px;
    right: 14px;
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 9px solid #dee2e6;
    z-index: 9998;
}

.dropdown-menu.abajo::before {
    bottom: auto;
    top: -8px;
    border-top: none;
    border-bottom: 8px solid white;
}

.dropdown-menu.abajo::after {
    bottom: auto;
    top: -9px;
    border-top: none;
    border-bottom: 9px solid #dee2e6;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 12px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s;
    border-bottom: 1px solid #f1f3f4;
    margin: 0;
}

.dropdown-menu button:last-child {
    border-bottom: none;
}

.dropdown-menu button:hover {
    background: #f8f9fa;
    color: #5c7f45;
    font-weight: 500;
}

.dropdown-menu button:active {
    background: #e9ecef;
}

/* ===== CARRITO DESLIZANTE ===== */
.btn-cart {
    position: relative;
    background: none;
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #333;
    transition: color 0.3s;
}


.btn-cart:hover {
    color: #5c7f45;
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #d32f2f;
    color: #fff;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.overlay-carrito {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    display: none;
    backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.panel-carrito {
    position: fixed;
    top: 0;
    right: -550px;
    width: 550px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.panel-carrito.abierto {
    right: 0;
}

.panel-carrito .card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #5c7f45, #3d5a34);
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.panel-carrito .card-header h5 {
    margin: 0;
    font-weight: 600;
    color: white;
    font-size: 1.25rem;
}

.panel-carrito .btn-close {
    filter: invert(1) brightness(2);
    opacity: 0.8;
    transition: all 0.3s ease;
    padding: 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}

.panel-carrito .btn-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.panel-carrito .card-body {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.carrito-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:1.5rem;
    background:linear-gradient(135deg,#5c7f45,#3d5a34);
    color:white;
}

.carrito-close{
    background:rgba(255,255,255,.15);
    border:none;
    width:36px;
    height:36px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    transition:.3s;
    color:white;
    font-size:14px;
}

.carrito-close:hover{
    background:rgba(255,255,255,.3);
    transform:scale(1.1);
}

#carritoVacio {
    padding: 4rem 2rem;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

#carritoVacio .fas {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

#carritoVacio h5 {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1.2rem;
}

#carritoVacio p {
    margin-bottom: 2rem;
    font-size: 1rem;
}

#carritoVacio .btn-primary {
    background: #5c7f45;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
}

#carritoVacio .btn-primary:hover {
    background: #3d5a34;
}

.panel-carrito .producto-info {
    padding: 0.5rem 0;
}

.panel-carrito .producto-nombre {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.panel-carrito .precio-unitario {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.8rem;
    color: #e67e22;
    font-weight: 500;
    background: rgba(230, 126, 34, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.panel-carrito .table-responsive {
    flex: 1;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.panel-carrito .table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.panel-carrito .table th {
    border-top: none;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 1rem 0.75rem;
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 5;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.panel-carrito .table td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
}

.panel-carrito .producto-td {
    max-width: 220px;
    min-width: 200px;
}

.panel-carrito .cantidad-td {
    width: 120px;
    text-align: center;
}

.panel-carrito .cantidad-td input {
    width: 70px;
    text-align: center;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s;
}

.panel-carrito .cantidad-td input:focus {
    border-color: #5c7f45;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(92, 127, 69, 0.25);
}

.panel-carrito .precio-total-td {
    width: 120px;
    text-align: right;
    font-weight: 600;
}

.panel-carrito .precio-total {
    color: #27ae60;
    font-size: 0.9rem;
    font-weight: 600;
}

.panel-carrito .acciones-td {
    width: 60px;
    text-align: center;
}

.panel-carrito .btn-eliminar-item {
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 1rem;
}

.panel-carrito .btn-eliminar-item:hover {
    background-color: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

.panel-carrito .carrito-footer {
    padding: 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    position: sticky;
    bottom: 0;
}

.panel-carrito .carrito-footer .btn {
    padding: 0.75rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s;
}

.panel-carrito .carrito-footer .btn-success {
    background: #5c7f45;
    border: none;
}

.panel-carrito .carrito-footer .btn-success:hover {
    background: #3d5a34;
}

.panel-carrito .carrito-footer .btn-outline-primary {
    border-color: #5c7f45;
    color: #5c7f45;
}

.panel-carrito .carrito-footer .btn-outline-primary:hover {
    background: #5c7f45;
    color: white;
}

.panel-carrito .carrito-footer .btn-outline-danger:hover {
    background: #dc3545;
    color: white;
}

/* ===== EFECTOS Y ANIMACIONES ===== */
.agregando {
    position: relative;
    opacity: 0.7;
}

.agregando::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #5c7f45;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.mobile-overlay {
    display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .shop-wrapper {
        grid-template-columns: 1fr;
    }

    .filters {
        position: fixed;
        top: 64px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 64px);
        background: #f4f6f3;
        padding: 20px;
        border-radius: 0 12px 12px 0;
        z-index: 2000;
        box-shadow: 4px 0 18px rgba(0, 0, 0, .25);
        overflow-y: auto;
        transition: .3s;
    }

    .filters.open {
        left: 0;
    }

    .filters-btn {
        display: block;
        margin-bottom: 15px;
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .35);
        z-index: 1500;
    }

    .mobile-overlay.show {
        display: block;
    }
}

@media (max-width: 768px) {
    .product-card {
        min-height: 380px;
    }

    .product-img-wrapper {
        height: 150px;
    }

    .brand-circle {
        top: 140px;
        width: 48px;
        height: 48px;
    }

    .brand-circle img {
        width: 32px;
    }

    .product-name {
        min-height: 50px;
        max-height: 70px;
        -webkit-line-clamp: 2;
    }

    .btn-cart-container {
        gap: 4px;
    }

    .quantity-controls {
        gap: 4px;
        height: 36px;
    }

    .qty-btn {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .btn-add {
        height: 36px;
        font-size: 13px;
        padding: 8px;
    }

    .qty-input-wrapper {
        padding: 0 8px;
    }

    .qty-input {
        font-size: 14px;
    }

    .qty-label {
        font-size: 11px;
    }

    .dropdown-toggle {
        width: 36px;
        height: 36px;
    }

    .dropdown-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99998; /* IMPORTANTE: menos que el dropdown */
        display: none;
        animation: fadeIn 0.3s ease;
        pointer-events: auto; /* Permitir clicks */
    }
    
    .dropdown-overlay.show {
        display: block;
    }
    
    .dropdown-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        margin: 0;
        border-radius: 12px 12px 0 0;
        max-height: 70vh; /* Más alto para mejor visibilidad */
        overflow-y: auto;
        animation: slideUp 0.3s ease;
        z-index: 99999; /* MÁS ALTO que el overlay */
        width: 100%;
        min-width: unset;
        transform: translateY(0); /* Reset para animación */
    }
    
    /* Asegurar que el dropdown esté por encima de TODO */
    .dropdown-menu.show {
        display: block;
        transform: translateY(0);
    }
    
    /* Mejorar la animación */
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    /* Estilos específicos para botones en mobile */
    .dropdown-menu button {
        padding: 16px 20px; /* Más grande para touch */
        font-size: 16px; /* Texto más grande */
        border-bottom: 1px solid #eee;
    }
    
    .dropdown-menu button:active {
        background: #f0f0f0;
    }
    
    /* Header del dropdown móvil */
    .dropdown-menu::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        display: block !important; /* Forzar mostrar en mobile */
    }

    .panel-carrito {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }

    .panel-carrito .producto-td {
        max-width: 150px;
    }
}

/* Estilos adicionales para mejor experiencia móvil */
@media (max-width: 768px) {
    /* Header del dropdown móvil */
    .dropdown-header {
        padding: 15px 20px;
        font-weight: 600;
        color: #333;
        border-bottom: 1px solid #eee;
        background: #f8f9fa;
        font-size: 16px;
        text-align: center;
    }
    
    /* Botón de cancelar en móvil */
    .dropdown-menu .cancel-btn {
        margin-top: 10px;
        background: #f8f9fa;
        color: #666;
        text-align: center;
        border-top: 1px solid #eee;
        font-weight: 500;
    }
    
    .dropdown-menu .cancel-btn:hover {
        background: #e9ecef;
        color: #333;
    }
    
    /* Mejorar contraste para botones en móvil */
    .dropdown-menu button {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
    }
    
    .dropdown-menu button i {
        width: 20px;
        text-align: center;
        color: #5c7f45;
    }
    
    /* Asegurar que el z-index sea correcto */
    .dropdown-overlay {
        z-index: 99998;
    }
    
    .dropdown-menu {
        z-index: 99999;
    }
    
    /* Asegurar que el body no scrollee cuando el dropdown está abierto */
    body.dropdown-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    /* Mejorar el "handle" del bottom sheet */
    .dropdown-menu::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        display: block !important;
    }
}

/* ===== DROPDOWN MOBILE - VERSIÓN SIMPLIFICADA ===== */
@media (max-width: 768px) {
    .dropdown-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99998;
        display: none;
        animation: fadeIn 0.2s ease;
        opacity: 0;
        transition: opacity 0.2s ease;
    }
    
    .dropdown-overlay.active {
        display: block;
        opacity: 1;
    }
    
    .dropdown-menu {
        position: fixed;
        bottom: -100%; /* Comienza fuera de pantalla */
        left: 0;
        right: 0;
        width: 100%;
        background: white;
        border-radius: 20px 20px 0 0;
        max-height: 80vh;
        overflow-y: auto;
        z-index: 99999;
        padding-bottom: env(safe-area-inset-bottom); /* Para iPhone X+ */
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .dropdown-menu.show {
        bottom: 0;
    }
    
    /* Handle para arrastrar */
    .dropdown-handle {
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: 12px auto;
    }
    
    /* Botones en móvil */
    .dropdown-menu button {
        padding: 16px 20px;
        font-size: 16px;
        border-bottom: 1px solid #f0f0f0;
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        background: none;
        border: none;
        text-align: left;
        cursor: pointer;
        color: #333;
        transition: background 0.2s;
    }
    
    .dropdown-menu button:last-child {
        border-bottom: none;
    }
    
    .dropdown-menu button:hover {
        background: #f8f9fa;
    }
    
    .dropdown-menu button i {
        width: 20px;
        color: #5c7f45;
    }
    
    /* Botón de cerrar específico para móvil */
    .dropdown-close-btn {
        margin-top: 10px;
        padding: 16px;
        text-align: center;
        color: #666;
        font-weight: 500;
        border-top: 1px solid #f0f0f0;
        background: #f8f9fa;
    }
    
    /* Prevenir scroll del body cuando dropdown está abierto */
    body.no-scroll {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
}



.user-menu{
    position:relative;
}

.user-btn{
    background:#111827;
    color:white;
    border:none;
    padding:10px 16px;
    border-radius:10px;
    cursor:pointer;
    display:flex;
    align-items:center;
    gap:8px;
    font-weight:600;
}

.dropdown{
    position:absolute;
    right:0;
    top:50px;
    background:white;
    border-radius:12px;
    box-shadow:0 15px 40px rgba(0,0,0,.15);
    min-width:200px;
    overflow:hidden;
    display:none;
    z-index:999;
}

.dropdown.show{
    display:block;
}

.dropdown a{
    display:flex;
    align-items:center;
    gap:10px;
    padding:14px 16px;
    text-decoration:none;
    color:#111827;
    font-size:14px;
}

.dropdown a:hover{
    background:#f3f4f6;
}


.btn-login {
  background: #2f4f2f;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}



.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
}
@media (max-width: 768px) {
    .header-center {
        display: none !important;
    }
}

.carrito-total-box{
    background:white;
    border-radius:12px;
    padding:18px;
    margin-bottom:20px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    box-shadow:0 5px 15px rgba(0,0,0,.05);
    font-size:18px;
}

.carrito-total-box strong{
    color:#1b5e20;
    font-size:22px;
}

.minimo-alert-danger{
    background:linear-gradient(135deg,#ff4d4f,#b71c1c);
    color:white;
    padding:16px;
    border-radius:12px;
    margin-bottom:18px;
    font-size:15px;
    box-shadow:0 8px 20px rgba(183,28,28,.25);
    display:flex;
    align-items:center;
    font-weight:500;
}

.minimo-alert-danger strong{
    font-size:16px;
}

@keyframes bounceSoft {
    0% { transform:scale(1); }
    30% { transform:scale(1.05); }
    60% { transform:scale(.98); }
    100% { transform:scale(1); }
}

.bounce{
    animation:bounceSoft .5s ease;
}

.btn-finalizar{
    width:100%;
    padding:16px;
    border:none;
    border-radius:12px;
    font-size:16px;
    font-weight:600;
    background:linear-gradient(135deg,#2e7d32,#1b5e20);
    color:white;
    cursor:pointer;
    transition:.3s;
    box-shadow:0 8px 20px rgba(46,125,50,.3);
}

.btn-finalizar:hover{
    transform:translateY(-2px);
    box-shadow:0 12px 25px rgba(46,125,50,.4);
}

.btn-finalizar:disabled{
    opacity:.6;
    cursor:not-allowed;
    box-shadow:none;
}

.btn-vaciar{
    width:100%;
    padding:16px;
    border:none;
    border-radius:12px;
    font-size:16px;
    font-weight:600;
    background:linear-gradient(135deg,#e53935,#b71c1c);
    color:white;
    cursor:pointer;
    transition:.3s;
    box-shadow:0 6px 15px rgba(229,57,53,.3);
}

.btn-vaciar:hover{
    transform:translateY(-2px);
    box-shadow:0 10px 20px rgba(229,57,53,.4);
}

.carrito-botones{
    display:flex;
    gap:12px;
    width:100%;
}

.carrito-botones button{
    flex:1;
}

.btn-finalizar,
.btn-vaciar{
    padding:14px;
}

@media (max-width:480px){
    .carrito-botones{
        flex-direction:column;
    }
}

.precio-box{
    position:relative;
    margin-top:10px;
}

.precio-viejo{
    text-decoration:line-through;
    color:#999;
    font-size:14px;
    display:block;
}

.precio-nuevo{
    font-size:20px;
    font-weight:700;
    color:#c62828;
}

.precio-normal{
    font-size:18px;
    font-weight:600;
    color:#1b5e20;
}

.badge-descuento{
    position:absolute;
    top:-10px;
    right:0;
    background:#ff1744;
    color:white;
    padding:4px 8px;
    font-size:12px;
    border-radius:20px;
    font-weight:600;
}

.badge-sinstock {
    background: #dc3545;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 5px;
}

.btn-sinstock {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: not-allowed;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-sinstock i {
    color: #dc3545;
}

.product-card[data-stock="0"] .precio-box {
    opacity: 0.5;
}

.product-card[data-stock="0"] .product-img-wrapper {
    opacity: 0.5;
}