/**
 * CoolCheck Cart Canvas — Off-canvas cart drawer
 * Panier coulissant, chargé sur toutes les pages (sauf checkout)
 */

/* =============================================================
   NEUTRALISER LE MODAL NATIF ps_shoppingcart
   ============================================================= */
#blockcart-modal {
    display: none !important;
}

/* =============================================================
   OVERLAY
   ============================================================= */
.cc-canvas-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.cc-canvas-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =============================================================
   PANEL
   ============================================================= */
.cc-canvas-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: #fff;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #202223;
    font-size: 14px;
    line-height: 1.4;
}
.cc-canvas-panel.active {
    transform: translateX(0);
}
.cc-canvas-panel * {
    box-sizing: border-box;
}

/* =============================================================
   HEADER
   ============================================================= */
.cc-canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e3e5e7;
    flex-shrink: 0;
}
.cc-canvas-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #202223;
}
.cc-canvas-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--cc-text-light, #6d7175);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
    padding: 0;
}
.cc-canvas-close:hover {
    background: #f6f6f7;
    color: #202223;
}

/* =============================================================
   BODY (scrollable product list)
   ============================================================= */
.cc-canvas-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* =============================================================
   PRODUCT CARD
   ============================================================= */
.cc-canvas-product {
    display: flex;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    transition: opacity 0.2s ease;
}
.cc-canvas-product:last-child {
    border-bottom: none;
}
.cc-canvas-product-img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e3e5e7;
    flex-shrink: 0;
    background: #f6f6f7;
}
.cc-canvas-product-info {
    flex: 1;
    min-width: 0;
    padding-right: 24px;
}
.cc-canvas-product-name {
    font-size: 14px;
    font-weight: 500;
    color: #202223;
    margin: 0 0 2px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.cc-canvas-product-name a {
    color: inherit;
    text-decoration: none;
}
.cc-canvas-product-name a:hover {
    text-decoration: underline;
}
.cc-canvas-product-attrs {
    font-size: 12px;
    color: var(--cc-text-light, #6d7175);
    margin: 0 0 12px;
}
.cc-canvas-product-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Remove button */
.cc-canvas-product-remove-wrap {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 2;
}
.cc-canvas-product-remove {
    background: none;
    border: none;
    font-size: 18px;
    color: #b0b5b9;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    transition: color 0.15s;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}
.cc-canvas-product-remove:hover {
    color: #d72c0d;
    background: #fef2f0;
}

/* Confirmation overlay — plein produit, fond semi-transparent */
.cc-canvas-confirm {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 3;
    border-radius: 4px;
    animation: cc-canvas-confirm-in 0.2s ease;
}
.cc-canvas-confirm-label {
    font-size: 14px;
    color: #d72c0d;
    font-weight: 600;
}
.cc-canvas-confirm-yes,
.cc-canvas-confirm-no {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid;
    font-family: inherit;
    line-height: 1.3;
    transition: background 0.15s, transform 0.1s;
}
.cc-canvas-confirm-yes:active,
.cc-canvas-confirm-no:active {
    transform: scale(0.96);
}
.cc-canvas-confirm-yes {
    background: #d72c0d;
    color: #fff;
    border-color: #d72c0d;
}
.cc-canvas-confirm-yes:hover {
    background: #b71c1c;
    border-color: #b71c1c;
}
.cc-canvas-confirm-no {
    background: #fff;
    color: #202223;
    border-color: #c9cccf;
}
.cc-canvas-confirm-no:hover {
    background: #f6f6f7;
}
@keyframes cc-canvas-confirm-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* =============================================================
   QUANTITY CONTROLS
   ============================================================= */
.cc-canvas-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #c9cccf;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}
.cc-canvas-qty button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #202223;
    transition: background 0.15s;
    padding: 0;
    line-height: 1;
}
.cc-canvas-qty button:hover {
    background: #f6f6f7;
}
.cc-canvas-qty button:active {
    background: #e3e5e7;
}
.cc-canvas-qty-value {
    width: 36px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    border-left: 1px solid #c9cccf;
    border-right: 1px solid #c9cccf;
    line-height: 32px;
    color: #202223;
    -webkit-user-select: none;
    user-select: none;
}

/* Product price */
.cc-canvas-product-price {
    font-size: 14px;
    font-weight: 600;
    color: #202223;
    white-space: nowrap;
}

/* =============================================================
   FOOTER
   ============================================================= */
.cc-canvas-footer {
    border-top: 1px solid #e3e5e7;
    padding: 20px 24px;
    flex-shrink: 0;
    background: #fff;
}

/* =============================================================
   PROMO CODE
   ============================================================= */
.cc-canvas-promo {
    margin-bottom: 16px;
}
.cc-canvas-promo-form {
    display: flex;
    gap: 8px;
}
.cc-canvas-promo-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #c9cccf;
    border-radius: var(--cc-radius, 6px);
    font-size: 13px;
    color: #202223;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.cc-canvas-promo-input:focus {
    border-color: #008060;
    box-shadow: 0 0 0 2px rgba(0, 128, 96, 0.12);
}
.cc-canvas-promo-input::placeholder {
    color: #b0b5b9;
}
.cc-canvas-promo-submit {
    padding: 8px 16px !important;
    background: var(--cc-canvas-btn-coupon, #333333) !important;
    border: none !important;
    border-radius: var(--cc-radius, 6px) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: opacity 0.15s !important;
    font-family: inherit;
    color: #fff !important;
    white-space: nowrap;
}
.cc-canvas-promo-submit:hover {
    background: var(--cc-canvas-btn-hover, #004c3f) !important;
    color: #fff !important;
}

/* Promo messages */
.cc-canvas-promo-msg {
    font-size: 12px;
    margin-top: 6px;
    min-height: 0;
}
.cc-canvas-promo-error {
    color: #d72c0d;
}
.cc-canvas-promo-success {
    color: #008060;
}

/* =============================================================
   DISCOUNT TAGS
   ============================================================= */
.cc-canvas-discounts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.cc-canvas-discount-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f5e9;
    color: #008060;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.cc-canvas-discount-remove {
    background: none;
    border: none;
    color: #008060;
    cursor: pointer;
    font-size: 15px;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.cc-canvas-discount-remove:hover {
    opacity: 1;
}

/* =============================================================
   SUMMARY LINES
   ============================================================= */
.cc-canvas-summary {
    margin-bottom: 4px;
}
.cc-canvas-summary-line {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--cc-text-light, #6d7175);
    margin-bottom: 6px;
}
.cc-canvas-summary-discount {
    color: #008060;
}
.cc-canvas-summary-note {
    font-size: 12px;
    color: #b0b5b9;
    margin-bottom: 12px;
    padding-top: 4px;
}
.cc-canvas-summary-total {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 600;
    color: #202223;
    padding-top: 12px;
    border-top: 1px solid #e3e5e7;
}

/* =============================================================
   CTA BUTTONS
   ============================================================= */
.cc-canvas-checkout-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    color: #fff !important;
    border: none;
    border-radius: var(--cc-radius, 8px);
    cursor: pointer;
    text-align: center;
    text-decoration: none !important;
    margin-top: 16px;
    transition: opacity 0.2s, transform 0.1s;
    font-family: inherit;
    letter-spacing: 0.01em;
}
.cc-canvas-checkout-btn:hover {
    background: var(--cc-canvas-btn-hover, #004c3f) !important;
    color: #fff !important;
    text-decoration: none !important;
}
.cc-canvas-checkout-btn:active {
    transform: scale(0.99);
}
.cc-canvas-continue {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 12px;
    padding: 8px;
    font-size: 13px;
    color: var(--cc-text-light, #6d7175);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    transition: color 0.15s;
}
.cc-canvas-continue:hover {
    color: #202223;
    text-decoration: underline;
}

/* =============================================================
   EMPTY STATE
   ============================================================= */
.cc-canvas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 60px 40px;
    text-align: center;
}
.cc-canvas-empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    opacity: 0.2;
}
.cc-canvas-empty-text {
    font-size: 15px;
    color: var(--cc-text-light, #6d7175);
    margin: 0 0 24px;
}
.cc-canvas-empty-btn {
    display: inline-block;
    padding: 10px 24px;
    border: 1px solid #c9cccf;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #202223;
    cursor: pointer;
    background: #fff;
    transition: background 0.15s;
}
.cc-canvas-empty-btn:hover {
    background: #f6f6f7;
}

/* =============================================================
   LOADING STATE
   ============================================================= */
.cc-canvas-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
}
.cc-canvas-spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid #e3e5e7;
    border-top-color: #008060;
    border-radius: 50%;
    animation: cc-canvas-spin 0.6s linear infinite;
}
@keyframes cc-canvas-spin {
    to { transform: rotate(360deg); }
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 480px) {
    .cc-canvas-panel {
        width: 100vw;
    }
    .cc-canvas-product {
        padding: 16px 20px;
        gap: 12px;
    }
    .cc-canvas-product-img {
        width: 60px;
        height: 60px;
    }
    .cc-canvas-header,
    .cc-canvas-footer {
        padding: 16px 20px;
    }
}
