/* ═══════════════════════════════════════════════════════════════
   OFFCANVAS PROFESIONAL - ESTILOS MEJORADOS
═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

/* ── OVERLAY Y BASE ────────────────────────────────────── */
.offcanvas-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.offcanvas-overlay.active {
    opacity: 1;
    visibility: visible;
}

.offcanvas-carrito {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
    transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.offcanvas-carrito.active {
    right: 0;
}

/* ── HEADER ELEGANTE ───────────────────────────────────── */
.offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    background: linear-gradient(135deg, #28ce93 0%, #23b885 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.offcanvas-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.cart-icon-wrapper {
    background: rgba(255, 255, 255, 0.15);
    padding: 12px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.cart-icon {
    width: 24px;
    height: 24px;
    color: white;
}

.header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.offcanvas-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.5px;
}

.items-subtitle {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 400;
}

.cerrar-offcanvas {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.cerrar-offcanvas:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.cerrar-offcanvas svg {
    width: 20px;
    height: 20px;
}

/* ── CONTENIDO PRINCIPAL ───────────────────────────────── */
.offcanvas-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-items-container {
    flex: 1;
    overflow-y: auto;
    padding: 0px 28px 16px;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f9fafb;
}

.cart-items-container::-webkit-scrollbar {
    width: 6px;
}

.cart-items-container::-webkit-scrollbar-track {
    background: #f9fafb;
}

.cart-items-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.cart-items-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ── ITEMS DEL CARRITO ─────────────────────────────────── */
.cart-item {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid #f1f5f9;
    animation: slideInFromRight 0.4s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
    opacity: 0;
    transform: translateX(20px);
}

.cart-item:nth-child(1) {
    animation-delay: 0.1s;
}

.cart-item:nth-child(2) {
    animation-delay: 0.15s;
}

.cart-item:nth-child(3) {
    animation-delay: 0.2s;
}

.cart-item:nth-child(4) {
    animation-delay: 0.25s;
}

.cart-item:nth-child(5) {
    animation-delay: 0.3s;
}

.cart-item:last-child {
    border-bottom: none;
    margin-bottom: 8px;
}

.item-image {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.product-image:hover {
    border-color: #28ce93;
    transform: scale(1.02);
}

.image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.image-placeholder:hover {
    border-color: #28ce93;
    transform: scale(1.02);
}

.image-placeholder svg {
    width: 28px;
    height: 28px;
    color: #94a3b8;
}

.item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-name {
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
    font-size: 15px;
    line-height: 1.4;
    transition: all 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-name:hover {
    color: #28ce93;
}

.item-variant {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px #e2e8f0;
    flex-shrink: 0;
}

.variant-text {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
}

.quantity-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quantity-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.quantity-value {
    background: linear-gradient(135deg, #28ce93, #23b885);
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
    width: fit-content;
}

.price-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.item-price {
    font-weight: 700;
    color: #1e293b;
    font-size: 16px;
}

.unit-price {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
}

/* ── RESUMEN DEL PEDIDO ────────────────────────────────── */
.cart-summary {
    margin: 16px 28px 8px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
}

.summary-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.summary-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.summary-content {
    padding: 16px 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.summary-label {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.summary-value {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.summary-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(40, 206, 147, 0.1);
    border-radius: 10px;
    margin-top: 8px;
}

.summary-note svg {
    width: 16px;
    height: 16px;
    color: #28ce93;
    flex-shrink: 0;
}

.summary-note small {
    color: #0f766e;
    font-size: 12px;
    line-height: 1.4;
}

/* ── BOTONES DE ACCIÓN ─────────────────────────────────── */
.offcanvas-actions {
    padding: 24px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.btn-secondary {
    background: #1e88e5;
    color: white;
    border: 2px solid #1e88e5;
}

.btn-secondary:hover {
    background: #1976d2;
    border-color: #1976d2;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 136, 229, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, #28ce93 0%, #23b885 100%);
    color: white;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(40, 206, 147, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #23b885 0%, #1ca377 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 206, 147, 0.4);
}

/* ── ESTADO VACÍO ──────────────────────────────────────── */
.empty-cart {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
    text-align: center;
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    border: 2px solid #e2e8f0;
}

.empty-icon svg {
    width: 36px;
    height: 36px;
    color: #94a3b8;
}

.empty-content h4 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 12px 0;
}

.empty-content p {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 32px 0;
    max-width: 280px;
}

.empty-cta {
    min-width: 200px;
}

/* ── ANIMACIONES ───────────────────────────────────────── */
@keyframes slideInFromRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-summary {
    animation: fadeIn 0.5s ease forwards;
}

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 480px) {
    .offcanvas-carrito {
        width: 100%;
        right: -100%;
    }

    .offcanvas-header {
        padding: 20px 20px;
    }

    .cart-items-container,
    .offcanvas-actions {
        padding-left: 20px;
        padding-right: 20px;
    }

    .cart-summary {
        margin-left: 20px;
        margin-right: 20px;
    }
}

@media (max-width: 360px) {
    .btn {
        font-size: 14px;
        padding: 14px 20px;
    }

    .item-name {
        font-size: 14px;
    }
}
