/**
 * Carrito lateral (inc/cart-drawer.php, js/cart-drawer.js).
 * Se carga después de style.css (inc/assets.php).
 */

/* ==========================================================================
   ALL IMPORT - INTERACTIVE SIDE-CART DRAWER
   ========================================================================== */

.allimport-cart-drawer,
.allimport-cart-drawer *,
.allimport-cart-drawer *::before,
.allimport-cart-drawer *::after {
    box-sizing: border-box !important;
}

.allimport-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: #ffffff;
    z-index: 9999999;
    /* Sin sombra mientras está cerrado: fuera de pantalla se asomaba como una franja oscura en el borde derecho */
    box-shadow: none;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

.allimport-cart-drawer.is-active {
    transform: translateX(0);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.cart-drawer-icon {
    background: #eff6ff !important;
}

/* Empty State */
.allimport-cart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 20px;
    min-height: 280px;
}

.allimport-cart-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.allimport-cart-empty-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.allimport-cart-empty-desc {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 22px 0;
    max-width: 280px;
    line-height: 1.5;
}

.allimport-cart-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #2563eb;
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 999px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.allimport-cart-empty-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

/* Items List */
.allimport-cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.allimport-cart-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: opacity 0.2s ease;
    position: relative;
}

.allimport-cart-item.is-loading {
    opacity: 0.45;
    pointer-events: none;
}

.allimport-cart-item-thumb {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.allimport-cart-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.allimport-cart-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.allimport-cart-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.allimport-cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.allimport-cart-item-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.allimport-cart-item-name a:hover {
    color: #2563eb;
}

.allimport-cart-item-remove {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #94a3b8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.allimport-cart-item-remove:hover {
    color: #ef4444;
    background: #fee2e2;
}

.allimport-cart-item-unit-price {
    font-size: 13px;
    color: #64748b;
}

.allimport-cart-item-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.allimport-cart-item-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
}

.allimport-cart-qty-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
    transition: background 0.15s ease;
    user-select: none;
    padding: 0;
    line-height: 1;
}

.allimport-cart-qty-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.allimport-cart-qty-val {
    min-width: 28px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    padding: 0 4px;
}

.allimport-cart-item-line-total {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

/* Footer & Actions */
.allimport-cart-drawer-footer {
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 18px 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.allimport-cart-subtotal-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.allimport-cart-subtotal-bar .subtotal-amount {
    color: #2563eb;
    font-size: 18px;
}

.allimport-cart-trust-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #15803d;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 7px 10px;
    margin-bottom: 14px;
    font-weight: 600;
}

.allimport-cart-checkout-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: #16a34a;
    color: #ffffff !important;
    font-size: 16px;
    font-weight: 700;
    padding: 14px;
    border-radius: 12px;
    text-decoration: none !important;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.28);
    transition: all 0.2s ease;
    text-align: center;
    cursor: pointer;
}

.allimport-cart-checkout-cta:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(22, 163, 74, 0.38);
}

.allimport-cart-keep-shopping-btn {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 10px;
    font-size: 13px;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.allimport-cart-keep-shopping-btn:hover {
    color: #0f172a;
}

@media (max-width: 991px) {
.allimport-cart-drawer {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }
.allimport-cart-drawer .allimport-drawer-header {
        padding: 14px 16px !important;
    }
.allimport-cart-drawer .allimport-drawer-body {
        padding: 14px 16px !important;
    }
.allimport-cart-drawer-footer {
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)) 16px !important;
    }
    /* Stepper táctil ergonómico en móvil (36px de altura) */
    .allimport-cart-item-stepper {
        border-radius: 12px !important;
        border: 1.5px solid #cbd5e1 !important;
    }
.allimport-cart-qty-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
    }
.allimport-cart-qty-val {
        min-width: 34px !important;
        font-size: 14px !important;
        font-weight: 800 !important;
    }
    /* Botón eliminar producto accesible al tacto */
    .allimport-cart-item-remove {
        width: 32px !important;
        height: 32px !important;
        padding: 6px !important;
        border-radius: 8px !important;
    }
    /* Botón "Seguir explorando productos": botón secundario cómodo */
    .allimport-cart-keep-shopping-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        min-height: 42px !important;
        padding: 10px 16px !important;
        margin-top: 10px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        color: #475569 !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        text-decoration: none !important;
        cursor: pointer !important;
        transition: all 0.15s ease !important;
    }
.allimport-cart-keep-shopping-btn:active {
        background: #f1f5f9 !important;
        transform: scale(0.98) !important;
    }
}
