/* cart.css - FarmaciaDG - Integrated Design */

/* El botón del carrito en el header */
#cart-floating-btn {
    cursor: pointer;
}

/* FAB flotante del carrito — solo visible en desktop */
.cart-fab-desktop {
    display: none; /* Oculto por defecto, se activa solo en desktop */
    position: fixed;
    bottom: 97px; /* 25px del WA + 60px alto + 12px gap */
    right: 25px;
    z-index: 2000;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cart-fab-desktop:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.cart-fab-desktop .cart-count-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ff4757;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--brand-blue);
    padding: 2px;
}

/* Mostrar el FAB solo en pantallas de escritorio */
@media (min-width: 769px) {
    .cart-fab-desktop {
        display: flex;
    }
}

/* Drawer / Lateral del Carrito */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -450px; /* Ancho ajustable */
    width: 420px;
    max-width: 90%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 2100;
    box-shadow: -15px 0 50px rgba(0, 0, 0, 0.1);
    transition: right 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    display: flex;
    flex-direction: column;
}

.cart-drawer.active {
    right: 0;
}

.cart-header {
    background: #fff;
    color: var(--brand-blue);
    padding: 30px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.cart-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-header h2::before {
    content: '\f07a';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--brand-green);
}

.cart-header .close-btn {
    background: #f5f7fa;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #666;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.cart-header .close-btn:hover {
    background: #eee;
    color: #ee5253;
    transform: rotate(90deg);
}

/* Lista de Ítems */
.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 25px;
}

.cart-item {
    display: flex;
    gap: 18px;
    padding: 20px 0;
    border-bottom: 1px solid #f5f5f5;
    animation: slideInCart 0.4s ease forwards;
}

@keyframes slideInCart {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.cart-item-img {
    width: 85px;
    height: 85px;
    border-radius: 14px;
    background: #f8fafc;
    object-fit: contain;
    padding: 5px;
    border: 1px solid #f0f0f0;
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-info h4 {
    margin: 0 0 6px 0;
    font-size: 1rem;
    line-height: 1.3;
    color: #2d3436;
    font-weight: 600;
}

.cart-item-price {
    font-weight: 800;
    color: var(--brand-blue);
    font-size: 1.1rem;
    display: block;
    margin-bottom: 12px;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-control {
    display: flex;
    align-items: center;
    background: #f1f2f6;
    padding: 4px;
    border-radius: 30px;
    gap: 10px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #fff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.qty-btn:hover {
    background: var(--brand-blue);
    color: #fff;
}

.remove-item {
    color: #b2bec3;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    transition: color 0.2s;
    margin-left: auto;
}

.remove-item:hover {
    color: #ee5253;
}

/* Footer del Carrito */
.cart-footer {
    padding: 30px 25px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.02);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.cart-total span:first-child {
    color: #636e72;
    font-weight: 600;
}

.cart-total span:last-child {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--brand-blue);
}

.cart-checkout-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--brand-green), #43a047);
    color: #fff;
    border: none;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-checkout-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(97, 206, 112, 0.4);
}

.cart-checkout-btn i {
    font-size: 1.3rem;
}

/* Efecto de Overlay */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    z-index: 2050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Empty State */
.empty-cart-msg {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart-msg i {
    font-size: 4rem;
    color: #dfe6e9;
    margin-bottom: 20px;
    display: block;
}

.empty-cart-msg p {
    color: #b2bec3;
    font-size: 1.1rem;
    line-height: 1.5;
}


/* Ajustes para Desktop - Items más compactos para ver más productos */
@media (min-width: 769px) {
    .cart-item {
        padding: 12px 0;
        gap: 12px;
    }

    .cart-item-img {
        width: 62px;
        height: 62px;
    }

    .cart-item-info h4 {
        font-size: 0.9rem;
        margin-bottom: 4px;
    }

    .cart-item-price {
        font-size: 1rem;
        margin-bottom: 8px;
    }

    .cart-header {
        padding: 18px 25px;
    }

    .cart-items {
        padding: 12px 20px;
    }

    .cart-item-info {
        display: flex;
        flex-direction: column;
    }

    .cart-item-price-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .cart-item-price {
        margin-bottom: 0;
    }

    .cart-item-actions {
        gap: 6px;
    }

    .qty-control {
        padding: 2px 4px;
        gap: 6px;
    }

    .qty-btn {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    .qty-control span {
        font-size: 0.85rem;
        min-width: 14px;
        text-align: center;
    }

    .remove-item {
        font-size: 0.75rem;
        margin-left: 0;
    }
}

/* Ajustes para Mobile - Evitar solapamiento con otros botones flotantes */
@media (max-width: 768px) {
    .cart-floating-btn {
        bottom: 30px; /* Ya no hace falta subirlo porque no tiene competidores a la izquierda */
        left: 20px;
        right: auto;
        width: 65px;
        height: 65px;
    }
    
    .cart-drawer {
        width: 100%;
        right: -100%;
    }

    .cart-header {
        padding: 15px 20px; /* Reducido sustancialmente */
    }

    .cart-header h2 {
        font-size: 1.2rem;
    }

    .cart-item {
        padding: 12px 0; /* Menos espacio entre productos */
        gap: 12px;
    }

    .cart-item-img {
        width: 65px;
        height: 65px;
    }

    .cart-item-info h4 {
        font-size: 0.9rem;
    }

    .cart-item-price {
        font-size: 1rem;
        margin-bottom: 8px;
    }

    .cart-items {
        padding: 10px 20px;
    }

    .cart-footer {
        padding: 12px 20px; /* Reducido para ahorrar espacio */
    }
}


/* Aviso de retiro/envío */
.cart-info-notice {
    background: #f0f9ff;
    border: 1.5px solid #bae6fd;
    border-radius: 14px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    animation: fadeIn 0.4s ease;
}

.cart-info-notice i {
    color: #0369a1;
    font-size: 1.2rem;
}

.cart-info-notice p {
    margin: 0;
    font-size: 0.85rem;
    color: #0c4a6e;
    line-height: 1.4;
    font-weight: 600;
}

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

/* Pantalla de Confirmación Post-Pedido */
.checkout-success-view {
    text-align: center;
    padding: 60px 40px;
    animation: fadeIn 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.checkout-success-view > i {
    font-size: 5rem;
    color: var(--brand-green);
    margin-bottom: 25px;
    filter: drop-shadow(0 10px 15px rgba(37, 211, 102, 0.2));
}

/* Ícono WhatsApp en la vista de confirmación desktop */
.checkout-success-view > i.fa-whatsapp {
    color: #25d366;
    filter: drop-shadow(0 10px 15px rgba(37, 211, 102, 0.25));
}

.checkout-success-view p {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 4px 0 8px;
    line-height: 1.5;
}

.checkout-success-view h3 {
    font-size: 1.8rem;
    color: #1a1a1a;
    margin-bottom: 15px;
    font-weight: 800;
}

.checkout-success-view .receipt-info {
    font-size: 1rem;
    line-height: 1.6;
    color: #374151;
    font-weight: 600;
    background: #f0fdf4;
    padding: 25px;
    border-radius: 18px;
    border: 1.5px solid #dcfce7;
    margin: 20px 0;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.checkout-success-view .receipt-info::before {
    content: '"';
    position: absolute;
    top: 5px;
    left: 15px;
    font-size: 3rem;
    color: #25d366;
    opacity: 0.1;
    font-family: serif;
}

.checkout-success-view .reload-btn {
    border: none;
    padding: 13px 28px;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

/* Botón principal: confirmar envío */
.checkout-success-view .reload-btn--confirm {
    background: linear-gradient(135deg, #25d366, #1ebe5a);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}

.checkout-success-view .reload-btn--confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.45);
}

/* Botón secundario: volver al carrito */
.checkout-success-view .reload-btn--cancel {
    background: transparent;
    color: #6b7280;
    border: 1.5px solid #d1d5db;
}

.checkout-success-view .reload-btn--cancel:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
    transform: translateY(-1px);
}

/* Botón neutro: hacer otro pedido */
.checkout-success-view .reload-btn--neutral {
    background: #f3f4f6;
    color: #4b5563;
}

.checkout-success-view .reload-btn--neutral:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

/* Contenedor de los botones de confirmación */
.checkout-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
}


