/* ==========================================================================
   PAPELARTE - SIDE CART (DRAWER CART) STYLES
   DiseÃ±o minimalista, moderno y optimizado para alta conversiÃ³n (Sin emojis)
   ========================================================================== */

.ppa-sidecart {
    position: fixed;
    inset: 0;
    z-index: 999999;
    visibility: hidden;
    transition: visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ppa-sidecart.is-open {
    visibility: visible;
}

/* OVERLAY CON BACKDROP BLUR */
.ppa-sidecart-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.ppa-sidecart.is-open .ppa-sidecart-overlay {
    opacity: 1;
}

/* PANEL LATERAL DESLIZANTE */
.ppa-sidecart-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    background: #FFFFFF;
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    height: 100dvh;
    max-height: 100dvh;
}

@supports not (height: 100dvh) {
    .ppa-sidecart-panel {
        height: 100vh;
        max-height: 100vh;
    }
}

.ppa-sidecart.is-open .ppa-sidecart-panel {
    transform: translateX(0);
}

/* ENCABEZADO DEL CARRITO */
.ppa-sidecart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #E5E7EB;
    background: #FFFFFF;
}

.ppa-sidecart-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ppa-sidecart-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.2px;
}

.ppa-sidecart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #FEF2F2;
    color: var(--color-primary, #BC3838);
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
}

.ppa-sidecart-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #6B7280;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.ppa-sidecart-close:hover {
    background: #F3F4F6;
    color: #111827;
}

/* BARRA DE PROGRESO DE COMPRA MÃNIMA */
.ppa-sidecart-shipping-bar {
    padding: 14px 22px;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
}

.ppa-sidecart-shipping-text {
    font-size: 13px;
    color: #374151;
    margin-bottom: 8px;
    line-height: 1.4;
    text-align: center;
    word-break: break-word;
    hyphens: auto;
}

.ppa-sidecart-shipping-text strong {
    color: #111827;
    font-weight: 700;
}

.ppa-sidecart-progress-track {
    width: 100%;
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    overflow: hidden;
}

.ppa-sidecart-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10B981, #059669);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* CUERPO Y LISTADO DE PRODUCTOS */
.ppa-sidecart-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
    -webkit-overflow-scrolling: touch;
}

.ppa-sidecart-body.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ppa-sidecart-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ppa-sidecart-item {
    display: flex;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid #F3F4F6;
    align-items: flex-start;
}

.ppa-sidecart-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ppa-sidecart-thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    overflow: hidden;
    flex-shrink: 0;
}

.ppa-sidecart-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ppa-sidecart-info {
    flex: 1;
    min-width: 0;
}

.ppa-sidecart-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
}

.ppa-sidecart-item-title {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    color: #1F2937;
}

.ppa-sidecart-item-title a {
    color: inherit;
    text-decoration: none;
}

.ppa-sidecart-item-title a:hover {
    color: var(--color-primary, #BC3838);
}

.ppa-sidecart-remove {
    background: transparent;
    border: none;
    padding: 4px;
    color: #9CA3AF;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.ppa-sidecart-remove:hover {
    color: #DC2626;
    background: #FEE2E2;
}

.ppa-sidecart-item-meta {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 8px;
}

.ppa-sidecart-item-meta dl {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.ppa-sidecart-item-meta dt {
    font-weight: 600;
}

.ppa-sidecart-item-meta dd {
    margin: 0;
}

.ppa-sidecart-unit-price {
    font-size: 11px;
    color: var(--color-gray, #54595F);
    margin-top: 2px;
    margin-bottom: 4px;
}

.ppa-sidecart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

/* SELECTOR DE CANTIDAD (+ / -) */
.ppa-sidecart-qty-wrap {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid #E5E7EB;
    border-radius: 6px;
    background: #FFFFFF;
    overflow: hidden;
}

.ppa-qty-btn {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #4B5563;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}

.ppa-qty-btn:hover {
    background: #F3F4F6;
    color: #111827;
}

.ppa-qty-input {
    width: 32px;
    height: 28px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    padding: 0;
    margin: 0;
    -moz-appearance: textfield;
}

.ppa-qty-input::-webkit-outer-spin-button,
.ppa-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ppa-sidecart-item-price {
    font-size: 14.5px;
    font-weight: 700;
    color: #111827;
}

/* ESTADO VACÃO */
.ppa-sidecart-empty {
    padding: 60px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ppa-sidecart-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 36px;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.ppa-sidecart-empty-text {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 20px;
}

.ppa-sidecart-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: #F3F4F6;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.ppa-sidecart-btn-secondary:hover {
    background: #E5E7EB;
    color: #111827;
}

/* PIE DE CARRITO (TOTALES Y CTA) */
.ppa-sidecart-footer {
    padding: 18px 22px;
    border-top: 1px solid #E5E7EB;
    background: #FFFFFF;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.03);
}

.ppa-sidecart-footer-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ppa-sidecart-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ppa-sidecart-total-label {
    font-size: 15px;
    font-weight: 600;
    color: #4B5563;
}

.ppa-sidecart-total-value {
    font-size: 19px;
    font-weight: 800;
    color: #111827;
}

.ppa-sidecart-notice {
    font-size: 12px;
    color: #6B7280;
    text-align: center;
}

.ppa-sidecart-notice.ppa-notice-alert {
    color: #DC2626;
    font-weight: 600;
    background: #FEF2F2;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #FECACA;
}

.ppa-sidecart-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    background: var(--color-primary, #BC3838);
    color: #FFFFFF;
    font-size: 15.5px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(188, 56, 56, 0.25);
    transition: all 0.2s ease;
}

.ppa-sidecart-btn-primary:hover {
    background: #9E2A2B;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(188, 56, 56, 0.35);
    color: #FFFFFF;
}

.ppa-sidecart-btn-primary:active {
    transform: translateY(0);
}

.ppa-sidecart-btn-primary.is-disabled {
    opacity: 0.55;
    pointer-events: none;
    background: #9CA3AF;
    box-shadow: none;
    cursor: not-allowed;
}

.ppa-sidecart-continue-btn {
    background: transparent;
    border: none;
    padding: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #6B7280;
    cursor: pointer;
    text-align: center;
    transition: color 0.15s ease;
}

.ppa-sidecart-continue-btn:hover,
.ppa-sidecart-continue-btn:focus,
.ppa-sidecart-continue-btn:active {
    background: transparent !important;
    background-color: transparent !important;
    color: #111827;
    text-decoration: underline;
    outline: none;
    box-shadow: none;
}

/* RESPONSIVE MÃVIL */
@media (max-width: 480px) {
    .ppa-sidecart-panel {
        max-width: 100%;
    }
    .ppa-sidecart-header,
    .ppa-sidecart-shipping-bar,
    .ppa-sidecart-body,
    .ppa-sidecart-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* BOTÃN FLOTANTE NATIVO DE CARRITO */
.ppa-floating-cart-btn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999999;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #BC3838;
    color: #FFFFFF;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(188, 56, 56, 0.45);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, opacity 0.2s ease;
    user-select: none;
    text-decoration: none;
    opacity: 1;
    visibility: visible;
    box-sizing: border-box;
}

.ppa-floating-cart-btn:hover {
    background: #9E2A2B;
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 24px rgba(188, 56, 56, 0.55);
    color: #FFFFFF;
}

.ppa-floating-cart-btn:active {
    transform: translateY(0) scale(0.98);
}

.ppa-floating-cart-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ppa-floating-cart-icon-wrap svg {
    display: block;
    color: #FFFFFF;
}

.ppa-floating-cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    background: #FFFFFF;
    color: #BC3838;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    line-height: 1;
}

.ppa-floating-cart-label {
    letter-spacing: 0.2px;
    color: #FFFFFF;
    line-height: 1;
}

/* Ocultar botÃ³n flotante cuando el Side Cart estÃ¡ abierto */
body.ppa-sidecart-open .ppa-floating-cart-btn {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

/* En celulares, ubicarlo encima de la barra pegajosa */
@media (max-width: 767px) {
    .ppa-floating-cart-btn {
        right: 16px;
        bottom: 80px;
        padding: 10px 16px;
        font-size: 13px;
    }
    .ppa-qty-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    .ppa-qty-input {
        width: 40px;
        height: 40px;
        font-size: 15px;
    }
    .ppa-sidecart-qty-wrap {
        height: 40px;
    }
}

@media (max-width: 360px) {
    .ppa-sidecart-header,
    .ppa-sidecart-shipping-bar,
    .ppa-sidecart-body,
    .ppa-sidecart-footer {
        padding-left: 12px;
        padding-right: 12px;
    }
    .ppa-sidecart-title {
        font-size: 15px;
    }
    .ppa-sidecart-btn-primary {
        font-size: 14px;
        height: 44px;
    }
}



/* Mobile Single Product: Guarantee floating cart button stays above sticky buy bar */
@media (max-width: 767px) {
    body.single-product .ppa-floating-cart-btn {
        bottom: 86px !important;
    }
}
