/* ===== ESTILOS DEL CARRITO MEJORADO ===== */

/* Botón agregar al carrito */
.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background: #4a7c59;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-to-cart-btn:hover {
    background: #2d5016;
    transform: translateY(-2px);
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

/* Ícono del carrito */
.cart-icon {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cart-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
}

/* Overlay del carrito - Menos invasivo */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(1px);
    pointer-events: none;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Sidebar del carrito - Diseño modal mejorado */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-radius: 15px 0 0 15px;
    outline: none; /* Para accesibilidad */
}

.cart-sidebar.open {
    right: 0;
}

/* Asegurar que el carrito no interfiera con el contenido principal */
.cart-sidebar:not(.open) {
    pointer-events: none;
}

/* Header del carrito */
.cart-header {
    padding: 20px;
    background: linear-gradient(135deg, #4a7c59, #2d5016);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 15px 0 0 0;
    position: relative;
}

.cart-header h3 {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.minimize-cart {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.minimize-cart:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.close-cart {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.close-cart:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Estado minimizado del carrito */
.cart-sidebar.minimized {
    height: auto;
    max-height: 60px;
}

.cart-sidebar.minimized .cart-body,
.cart-sidebar.minimized .cart-footer {
    display: none;
}

.cart-sidebar.minimized .minimize-cart i:before {
    content: "\f077"; /* fa-chevron-up */
}

/* Cuerpo del carrito */
.cart-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    scrollbar-width: thin;
    scrollbar-color: #4a7c59 #f1f1f1;
}

.cart-items::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb {
    background: #4a7c59;
    border-radius: 3px;
}

/* Items del carrito */
.cart-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fafafa;
    transition: all 0.3s ease;
}

.cart-item:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
}

.cart-item-image {
    width: 70px;
    height: 70px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-item-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.cart-item-price {
    color: #4a7c59;
    font-weight: 700;
    font-size: 1rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background: #4a7c59;
    color: white;
    border-color: #4a7c59;
}

.cart-item-quantity {
    min-width: 25px;
    text-align: center;
    font-weight: 600;
    color: #333;
}

.remove-item {
    background: #ff4444;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    transition: all 0.2s ease;
}

.remove-item:hover {
    background: #cc0000;
    transform: scale(1.1);
}

/* Carrito vacío */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-cart i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-cart p {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.empty-cart small {
    color: #999;
}

/* Footer del carrito */
.cart-footer {
    padding: 20px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

.delivery-option {
    margin-bottom: 15px;
}

.delivery-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.delivery-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4a7c59;
}

.delivery-cost {
    margin-top: 8px;
    padding: 8px 12px;
    background: #e8f5e8;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #2d5016;
}

/* Totales del carrito */
.cart-totals {
    margin-bottom: 20px;
}

.cart-subtotal-row,
.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.cart-subtotal-row {
    color: #666;
    font-size: 0.95rem;
}

.cart-total-row {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
    border-top: 2px solid #4a7c59;
    padding-top: 12px;
}

/* Botones de acción */
.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkout-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkout-btn:hover {
    background: linear-gradient(135deg, #128c7e, #25d366);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

.continue-shopping {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #4a7c59;
    border: 2px solid #4a7c59;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.continue-shopping:hover {
    background: #4a7c59;
    color: white;
}

.empty-cart-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: #ff4444;
    border: 1px solid #ff4444;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.empty-cart-btn:hover {
    background: #ff4444;
    color: white;
}

/* ===== DISEÑO MÓVIL INSPIRADO EN LA REFERENCIA ===== */

/* Desktop - Comportamiento normal */
@media (min-width: 769px) {
    .cart-sidebar {
        width: 380px;
        right: -380px;
    }
    
    .cart-sidebar.open {
        right: 0;
    }
}

/* Móvil - Diseño compacto como la referencia */
@media (max-width: 768px) {
    .cart-overlay {
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(1px);
    }
    
    .cart-sidebar {
        width: 320px;
        max-width: 85vw;
        height: auto;
        max-height: 85vh;
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%) scale(0.8);
        border-radius: 12px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        opacity: 0;
        visibility: hidden;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .cart-sidebar.open {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        visibility: visible;
    }
    
    .cart-sidebar.minimized {
        transform: translate(-50%, -50%) scale(0.9);
        max-height: 80px;
        overflow: hidden;
    }
    
    .cart-header {
        padding: 12px 16px;
        border-radius: 12px 12px 0 0;
        background: linear-gradient(135deg, #4a7c59 0%, #2d5016 100%);
        position: relative;
        min-height: 50px;
    }
    
    .cart-header h3 {
        font-size: 1rem;
        font-weight: 600;
        margin: 0;
    }
    
    .cart-header-actions {
        gap: 8px;
    }
    
    .minimize-cart,
    .close-cart {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .cart-body {
        max-height: 45vh;
        overflow: hidden;
    }
    
    .cart-items {
        padding: 8px 12px;
        max-height: 35vh;
        overflow-y: auto;
    }
    
    .cart-item {
        padding: 8px;
        margin-bottom: 6px;
        border-radius: 6px;
        background: #fafafa;
        border: 1px solid #f0f0f0;
    }
    
    .cart-item-image {
        width: 40px;
        height: 40px;
        border-radius: 6px;
    }
    
    .cart-item-info {
        gap: 2px;
    }
    
    .cart-item-name {
        font-size: 0.8rem;
        font-weight: 600;
        line-height: 1.2;
        margin-bottom: 2px;
    }
    
    .cart-item-price {
        font-size: 0.85rem;
        font-weight: 700;
        color: #4a7c59;
    }
    
    .cart-item-controls {
        gap: 6px;
        margin-top: 6px;
    }
    
    .quantity-btn {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
        border-radius: 4px;
        font-weight: 600;
    }
    
    .cart-item-quantity {
        font-size: 0.8rem;
        min-width: 18px;
        font-weight: 600;
    }
    
    .remove-item {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
        border-radius: 4px;
    }
    
    .cart-footer {
        padding: 12px 16px;
        border-radius: 0 0 12px 12px;
        background: #f8f9fa;
        border-top: 1px solid #e9ecef;
    }
    
    .delivery-option {
        margin-bottom: 10px;
    }
    
    .delivery-checkbox {
        font-size: 0.8rem;
        gap: 6px;
    }
    
    .delivery-checkbox input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
    
    .delivery-cost {
        margin-top: 4px;
        padding: 4px 8px;
        font-size: 0.75rem;
        border-radius: 4px;
    }
    
    .cart-totals {
        margin-bottom: 12px;
    }
    
    .cart-subtotal-row,
    .cart-total-row {
        font-size: 0.85rem;
        padding: 4px 0;
    }
    
    .cart-total-row {
        font-size: 0.9rem;
        font-weight: 700;
        padding-top: 8px;
        border-top: 1px solid #dee2e6;
    }
    
    .cart-actions {
        gap: 8px;
    }
    
    .checkout-btn {
        padding: 10px 12px;
        font-size: 0.85rem;
        font-weight: 600;
        border-radius: 6px;
        letter-spacing: 0.3px;
    }
    
    .continue-shopping {
        padding: 8px 12px;
        font-size: 0.8rem;
        border-radius: 6px;
        font-weight: 500;
    }
    
    .empty-cart-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
        border-radius: 6px;
    }
    
    .empty-cart {
        padding: 30px 20px;
    }
    
    .empty-cart i {
        font-size: 2.5rem;
        margin-bottom: 12px;
    }
    
    .empty-cart p {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
    
    .empty-cart small {
        font-size: 0.8rem;
    }
}

/* Móvil muy pequeño - Optimización adicional */
@media (max-width: 480px) {
    .cart-sidebar {
        width: 300px;
        max-width: 90vw;
    }
    
    .cart-header {
        padding: 10px 14px;
    }
    
    .cart-header h3 {
        font-size: 0.9rem;
    }
    
    .cart-items {
        padding: 6px 10px;
        max-height: 30vh;
    }
    
    .cart-item {
        padding: 6px;
        margin-bottom: 4px;
    }
    
    .cart-item-image {
        width: 35px;
        height: 35px;
    }
    
    .cart-item-name {
        font-size: 0.75rem;
    }
    
    .cart-item-price {
        font-size: 0.8rem;
    }
    
    .quantity-btn {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }
    
    .cart-item-quantity {
        font-size: 0.75rem;
        min-width: 16px;
    }
    
    .remove-item {
        width: 22px;
        height: 22px;
        font-size: 0.65rem;
    }
    
    .cart-footer {
        padding: 10px 14px;
    }
    
    .checkout-btn {
        padding: 9px 10px;
        font-size: 0.8rem;
    }
    
    .continue-shopping {
        padding: 7px 10px;
        font-size: 0.75rem;
    }
}
/* =====
 MENSAJES TOAST MEJORADOS ===== */
.toast-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    color: #333;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-left: 4px solid #4a7c59;
}

.toast-message.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-message i:first-child {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-message span {
    flex: 1;
    font-weight: 500;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: #f0f0f0;
    color: #666;
}

/* Variantes de color para diferentes tipos */
.toast-success {
    border-left-color: #28a745;
}

.toast-success i:first-child {
    color: #28a745;
}

.toast-error {
    border-left-color: #dc3545;
}

.toast-error i:first-child {
    color: #dc3545;
}

.toast-warning {
    border-left-color: #ffc107;
}

.toast-warning i:first-child {
    color: #ffc107;
}

.toast-info {
    border-left-color: #17a2b8;
}

.toast-info i:first-child {
    color: #17a2b8;
}

/* Responsive para mensajes toast */
@media (max-width: 768px) {
    .toast-message {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .toast-message.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .toast-message {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .toast-message i:first-child {
        font-size: 1rem;
    }
}