/* =============================================
   SIDEBAR PANIER - SAVONNABLE
   ============================================= */

/* Variables */
:root {
    --sav-primary: #5a3b2e;
    --sav-secondary: #00604e;
    --sav-bg: #fbf6f2;
    --sav-border: #e2e0df;
    --sav-text: #1f2937;
    --sav-text-light: #6b7280;
    --sav-radius: 10px;
}

/* Overlay */
.sav-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99998;
}

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

/* Sidebar Container */
.sav-sidebar {
    position: fixed;
    top: 0;
    right: -650px;
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 99999;
    display: flex;
    flex-direction: column;
}

.sav-sidebar.active {
    right: 0;
}

/* Content wrapper */
.sav-sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Zone scrollable */
.sav-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
}

/* Zone 1: Header */
.sav-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--sav-border);
    background: #fff;
}

.sav-sidebar-header h2 {
    font-size: 23px;
    font-weight: 600;
    color: var(--sav-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sav-sidebar-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #02a783;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 50%;
}

.sav-sidebar-count:empty {
    display: none;
}

.sav-sidebar-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--sav-text-light);
    cursor: pointer;
    transition: color 0.2s;
}

.sav-sidebar-close:hover {
    color: var(--sav-text);
}

/* Zone 2: Offres */
.sav-sidebar-offers {
    padding: 16px 0;
    background: var(--sav-bg);
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    border-bottom: 1px solid var(--sav-border);
}

.sav-offer {
    margin-bottom: 12px;
}

.sav-offer:last-child {
    margin-bottom: 0;
}

.sav-offer-text {
    font-family: 'LesSavonnables';
    font-size: 18px;
    font-weight: 500;
    color: var(--sav-primary);
    margin-bottom: 8px;
    line-height: 21px;
}

.sav-offer-text strong {
    font-family: 'LesSavonnablesBold';
    font-weight: 700;
}

.sav-offer-progress {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.sav-offer-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.sav-offer-remaining {
    font-size: 14px;
    color: #000;
    margin-top: 6px;
    text-align: right;
}

.sav-offer-complete {
    font-family: 'LesSavonnablesMedium';
    font-weight: 600;
    font-size: 17px;
    text-align: center;
}

.sav-offer-text-complete {
    font-family: 'LesSavonnablesMedium';
}

.sav-sidebar-offers.sav-offers-complete {
    /* background color set dynamically via JS */
}

.sav-offer-icon {
    font-size: 18px;
}

/* Dual progress bar */
.sav-offer-dual {
    margin-top: 0;
}

.sav-offer-dual .sav-offer-text {
    margin-bottom: 12px;
}

.sav-offer-dual .sav-offer-text-complete {
    margin-bottom: 0;
}

.sav-dual-track {
    position: relative;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: visible;
}

.sav-dual-fill-1 {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #67e8f9;
    border-radius: 4px 0 0 4px;
    transition: width 0.3s ease;
}

.sav-dual-fill-2 {
    position: absolute;
    top: 0;
    height: 100%;
    background: #c4b5fd;
    border-radius: 0;
    transition: width 0.3s ease;
}

.sav-dual-marker {
    position: absolute;
    top: -4px;
    width: 2px;
    height: 16px;
    background: var(--sav-text);
    transform: translateX(-50%);
}

.sav-dual-labels {
    position: relative;
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    height: 40px;
}

.sav-dual-label {
    position: absolute;
    font-size: 14px;
    color: var(--sav-text-light);
    line-height: 1.1;
}

.sav-dual-label small {
    font-weight: 600;
    color: var(--sav-text);
}

.sav-dual-label-1 {
    text-align: center;
    transform: translateX(-50%);
}

.sav-dual-label-2 {
    right: 0;
    text-align: right;
}

/* Zone 3: Produits suggérés */
.sav-sidebar-suggested {
    background: var(--sav-bg);
    margin: 0 -20px;
    padding: 10px 0 10px 20px;
    border-bottom: 1px solid var(--sav-border);
}

.sav-sidebar-suggested:empty {
    display: none;
}

.sav-suggested-title {
    font-family: 'LesSavonnablesMedium', serif;
    font-size: 20px;
    color: var(--sav-primary);
    margin-bottom: 10px;
}

.sav-suggested-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
}

.sav-suggested-scroll::-webkit-scrollbar {
    display: none;
}

.sav-suggested-item {
    flex: 0 0 70%;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 12px;
    padding: 12px;
}

.sav-suggested-item:last-child {
    margin-right: 20px;
}

.sav-suggested-img-wrap {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sav-suggested-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.sav-suggested-info {
    flex: 1;
    min-width: 0;
}

.sav-suggested-name {
    font-size: 17px;
    font-weight: 500;
    color: var(--sav-text);
    line-height: 18px;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sav-suggested-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--sav-primary);
}

.sav-suggested-add {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #c9a87c;
    border: 1px solid #c9a87c;
    border-radius: 100%;
    cursor: pointer;
    transition: all 0.2s;
}

.sav-suggested-add:hover {
    background: #c9a87c;
    color: #fff;
}

/* Zone 4: Liste produits */
.sav-sidebar-items {
    padding: 0;
}

.sav-sidebar-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--sav-text-light);
}

.sav-cart-item {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--sav-border);
    align-items: center;
}

.sav-cart-item:last-child {
    border-bottom: none;
}

.sav-cart-item-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    background: #f9fafb;
    flex-shrink: 0;
}

.sav-cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.sav-cart-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.sav-cart-item-name {
    font-size: 18px;
    font-family: 'LesSavonnablesMedium';
    color: var(--sav-text);
    line-height: 1.4;
    flex: 1;
}

.sav-cart-item-name span {
    display: inline;
}

.sav-cart-item-remove {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--sav-text-light);
    cursor: pointer;
    transition: color 0.2s;
    flex-shrink: 0;
}

.sav-cart-item-remove:hover {
    color: #ef4444;
}

.sav-cart-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sav-cart-item-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--sav-primary);
}

.sav-cart-item-price del {
    color: var(--sav-text-light);
    font-weight: 400;
    margin-right: 8px;
}

.sav-cart-item-price ins {
    text-decoration: none;
    color: var(--sav-primary);
}

.sav-cart-item-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #c9a87c;
    border-radius: 6px;
    overflow: hidden;
    height: 35px;
}

.sav-qty-btn {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: none;
    border-right: 1px solid #c9a87c;
    font-size: 20px;
    color: #c9a87c;
    cursor: pointer;
    transition: background 0.2s;
}

.sav-qty-btn:last-child {
    border-right: none;
    border-left: 1px solid #c9a87c;
}

.sav-qty-btn:hover {
    background: #f9f6f2;
    color: #c9a87c !important;
}

.sav-qty-value {
    width: 40px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: var(--sav-text);
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.sav-qty-value:hover {
    background: #f5f5f5;
}

/* Zone 7: Footer (fixe) */
.sav-sidebar-footer {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid var(--sav-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.sav-sidebar-checkout-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: #02a783;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--sav-radius);
    cursor: pointer;
    transition: background 0.2s;
}

.sav-sidebar-checkout-btn:hover {
    background: #0a866b;
    color: #fff;
}

.sav-sidebar-payments {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    max-width: 70%;
    margin-left: auto;
    margin-right: auto;
}

.sav-payment-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 27px;
    border: 1px solid #ecebea;
    border-radius: 4px;
    padding: 2px 4px;
    background: #fff;
}

.sav-payment-icon svg {
    height: 15px;
    width: auto;
}

/* Zone 5: Box Récapitulatif */
.sav-sidebar-recap {
    background: var(--sav-bg);
    border-radius: var(--sav-radius);
    padding: 20px;
    margin-top: 16px;
}

.sav-sidebar-recap-title {
    font-size: 21px;
    font-family: 'LesSavonnablesMedium';
    color: var(--sav-text);
    margin-bottom: 16px;
}

.sav-sidebar-summary {
    
}

.sav-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 15px;
    color: var(--sav-text);
}

.sav-summary-row:last-child {
    border-bottom: none;
}

.sav-summary-total {
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid var(--sav-border);
    font-weight: 600;
    font-size: 17px;
}

.sav-summary-total span:last-child {
    color: var(--sav-primary);
}

/* Zone 6: Code promo */
.sav-sidebar-coupon {
    padding: 20px 0;
    text-align: center;
}

.sav-coupon-toggle {
    font-family: 'LesSavonnablesMedium';
    font-size: 18px;
    color: #2271b2 !important;
    text-decoration: none;
    cursor: pointer;
}

.sav-coupon-toggle:hover {
    text-decoration: none !important;
    opacity: 0.8;
}

.sav-coupon-form {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.sav-coupon-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid var(--sav-border);
    border-radius: var(--sav-radius);
    outline: none;
}

.sav-coupon-input:focus {
    border-color: var(--sav-primary);
}

.sav-coupon-apply {
    padding: 12px 20px;
    background: #9ca3af;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--sav-radius);
    cursor: pointer;
    transition: background 0.2s;
}

.sav-coupon-apply:hover {
    background: #6b7280;
}

.sav-coupon-message {
    margin-top: 10px;
    font-size: 14px;
}

.sav-coupon-message.success {
    color: #059669;
}

.sav-coupon-message.error {
    color: #dc2626;
}

/* Ligne coupon dans le récap */
.sav-summary-coupon {
    color: #059669;
    font-family: 'LesSavonnablesBold';
}

.sav-summary-coupon span:last-child {
    color: #059669;
}

.sav-summary-row bdi {
    font-size: 17px;
}

.sav-summary-total bdi {
    font-size: 20px;
}

.sav-remove-coupon {
    color: #dc2626;
    text-decoration: none;
    font-size: 13px;
    margin-left: 5px;
}

.sav-remove-coupon:hover {
    text-decoration: underline;
}

/* Mobile */
@media (max-width: 480px) {
    .sav-sidebar {
        max-width: 93%;
    }
    
    .sav-suggested-item {
        flex: 0 0 85%;
    }
    
    .sav-suggested-add {
        width: 34px;
        height: 34px;
    }
    
    .sav-offer-text {
        text-align: center;
    }
}

/* =============================================
   MODAL QUANTITÉ
   ============================================= */
.sav-qty-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.sav-qty-modal.active {
    display: flex;
}

.sav-qty-modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.sav-qty-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--sav-text);
    margin-bottom: 12px;
}

.sav-qty-modal-label {
    font-size: 15px;
    color: var(--sav-text);
    margin-bottom: 16px;
}

.sav-qty-modal-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #3d9a8b;
    border-radius: 12px;
    outline: none;
    box-sizing: border-box;
    -moz-appearance: textfield;
}

.sav-qty-modal-input::-webkit-outer-spin-button,
.sav-qty-modal-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sav-qty-modal-input:focus {
    border-color: #2d7a6b;
}

.sav-qty-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.sav-qty-modal-btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.sav-qty-modal-cancel {
    background: #b8f4f0;
    color: #1a5c54;
}

.sav-qty-modal-cancel:hover {
    background: #9ee9e4;
}

.sav-qty-modal-ok {
    background: #2d7a6b;
    color: #fff;
}

.sav-qty-modal-ok:hover {
    background: #236358;
}

.sav-qty-modal-btn:active {
    transform: scale(0.98);
}

/* Animation loading */
.sav-sidebar-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.sav-sidebar-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid var(--sav-border);
    border-top-color: var(--sav-primary);
    border-radius: 50%;
    animation: sav-spin 0.8s linear infinite;
}

@keyframes sav-spin {
    to { transform: rotate(360deg); }
}


/* ============================================
   Styles additionnels (Free Gifts, livraison, tooltip)
   ============================================ */
/* Free Gifts Styles */
.sav-gift-price {
    color: #dc2626 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}
/* Délai livraison sidebar */
#sav-sidebar-livraison {
    display: block;
    text-align: center;
    margin-bottom: 10px;
}
.sav-livraison-text::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #4caf50;
    border-radius: 50%;
    margin-right: 5px;
    animation: blink_liv 2s infinite;
}
@keyframes blink_liv {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
/* Tooltip sous-total */
.sav-subtotal-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-left: 4px;
    vertical-align: middle;
}
.sav-subtotal-help svg {
    color: #6b7280;
    transition: color 0.2s;
}
.sav-subtotal-help:hover svg,
.sav-subtotal-help:focus svg {
    color: #374151;
}
.sav-subtotal-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #374151;
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    width: 220px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
}
.sav-subtotal-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #374151;
}
.sav-subtotal-help:hover .sav-subtotal-tooltip,
.sav-subtotal-help:focus .sav-subtotal-tooltip {
    opacity: 1;
    visibility: visible;
}
