/* =============================================
   KM Cart Widget - Button
   ============================================= */

.km-cart {
    position: relative;
}

.km-cart__link {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #BE9E67;
    border-radius: 4px;
    padding: 10px 16px;
    text-decoration: none !important;
    color: #fff !important;
    position: relative;
    transition: opacity 0.2s;
}

.km-cart__link:hover {
    color: #fff !important;
    opacity: 0.95;
}

.km-cart__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #fff;
}

.km-cart__content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.km-cart__label {
    font-family: Lato, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.2;
}

.km-cart__total {
    font-family: Lato, sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.km-cart__badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #fff;
    color: #333;
    font-family: Lato, sans-serif;
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* =============================================
   KM Cart Widget - Dropdown
   ============================================= */

.km-cart__dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 9999;
    padding-top: 8px;
    width: 360px;
}

.km-cart.km-cart--open .km-cart__dropdown {
    display: block;
}

.km-cart__dropdown-content {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

/* =============================================
   Dropdown - Header
   ============================================= */

.km-cart__dropdown-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.km-cart__dropdown-title {
    font-family: Lato, sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

/* =============================================
   Dropdown - Items list
   ============================================= */

.km-cart__items {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 380px;
    overflow-y: auto;
}

.km-cart__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #f5f5f5;
    position: relative;
    transition: background-color 0.15s;
}

.km-cart__item:hover {
    background-color: #fafafa;
}

.km-cart__item:last-child {
    border-bottom: none;
}

.km-cart__item-img {
    flex-shrink: 0;
}

.km-cart__item-img img {
    width: 56px;
    height: 56px;
    min-width: 56px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #f0f0f0;
}

.km-cart__item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.km-cart__item-name {
    font-family: Lato, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #333 !important;
    text-decoration: none !important;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.km-cart__item-name:hover {
    color: #BE9E67 !important;
}

.km-cart__item-meta {
    font-family: Lato, sans-serif;
    font-size: 13px;
    color: #888;
    line-height: 1.2;
}

.km-cart__item-meta .woocommerce-Price-amount {
    color: #BE9E67;
    font-weight: 600;
}

/* Quantity + price row */
.km-cart__item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.km-cart__item-qty {
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    background: #f9f9f9 !important;
    height: 30px !important;
}

.km-cart__qty-btn {
    width: 28px !important;
    height: 30px !important;
    min-width: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    color: #BE9E67 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: background 0.15s, color 0.15s !important;
    line-height: 1 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

.km-cart__qty-btn:hover {
    background: rgba(190, 158, 103, 0.1) !important;
    color: #a5873f !important;
}

.km-cart__qty-value {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    text-align: center !important;
    font-family: Lato, sans-serif !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #333 !important;
    line-height: 30px !important;
    background: #fff !important;
    border: none !important;
    border-left: 1px solid #ddd !important;
    border-right: 1px solid #ddd !important;
    padding: 0 !important;
    margin: 0 !important;
    appearance: textfield !important;
    -moz-appearance: textfield !important;
    outline: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.km-cart__qty-value:focus {
    background: #fff !important;
    color: #BE9E67 !important;
}

.km-cart__qty-value::-webkit-outer-spin-button,
.km-cart__qty-value::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.km-cart__item-price {
    font-family: Lato, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #BE9E67;
    white-space: nowrap;
}

.km-cart__item-price .woocommerce-Price-amount {
    color: #BE9E67;
    font-weight: 700;
}

.km-cart__item-price del {
    color: #999;
    font-weight: 400;
    font-size: 11px;
    margin-right: 4px;
}

.km-cart__item-price del .woocommerce-Price-amount {
    color: #999;
    font-weight: 400;
}

.km-cart__item-remove {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #ccc;
    transition: all 0.15s;
    text-decoration: none !important;
}

.km-cart__item-remove:hover {
    background-color: #fee;
    color: #e74c3c;
}

/* =============================================
   Dropdown - Footer
   ============================================= */

.km-cart__dropdown-footer {
    padding: 16px 20px 20px;
    background-color: #fafafa;
    border-top: 1px solid #f0f0f0;
}

.km-cart__subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-family: Lato, sans-serif;
    font-size: 15px;
    color: #333;
}

.km-cart__subtotal-price {
    font-weight: 700;
    font-size: 17px;
    color: #BE9E67;
}

.km-cart__dropdown-actions {
    display: flex;
    gap: 8px;
}

.km-cart__btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 4px;
    font-family: Lato, sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.km-cart__btn--outline {
    background-color: #fff;
    color: #555 !important;
    border: 1px solid #ddd;
}

.km-cart__btn--outline:hover {
    border-color: #BE9E67;
    color: #BE9E67 !important;
}

.km-cart__btn--primary {
    background: #BE9E67;
    color: #fff !important;
    border: none;
    box-shadow: 0 2px 8px rgba(190, 157, 104, 0.35);
}

.km-cart__btn--primary:hover {
    box-shadow: 0 4px 12px rgba(190, 157, 104, 0.5);
    transform: translateY(-1px);
}

/* =============================================
   Dropdown - Empty state
   ============================================= */

.km-cart__empty {
    padding: 32px 20px;
    text-align: center;
    color: #bbb;
}

.km-cart__empty svg {
    margin-bottom: 12px;
}

.km-cart__empty p {
    font-family: Lato, sans-serif;
    font-size: 14px;
    color: #999;
    margin: 0;
}

/* =============================================
   Scrollbar (items list)
   ============================================= */

.km-cart__items::-webkit-scrollbar {
    width: 4px;
}

.km-cart__items::-webkit-scrollbar-track {
    background: transparent;
}

.km-cart__items::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.km-cart__items::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* =============================================
   Loading state
   ============================================= */

.km-cart__dropdown-content.km-cart--loading {
    position: relative;
    pointer-events: none;
}

.km-cart__dropdown-content.km-cart--loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    z-index: 10;
}

.km-cart__dropdown-content.km-cart--loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #e5e5e5;
    border-top-color: #BE9E67;
    border-radius: 50%;
    z-index: 11;
    animation: km-cart-spin 0.6s linear infinite;
}

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

/* =============================================
   Masquer le suffixe de taxe (incl. VAT)
   ============================================= */

.km-cart .tax_label,
.km-cart small.woocommerce-price-suffix {
    display: none !important;
}

/* =============================================
   Responsive - Mobile
   ============================================= */

@media (max-width: 768px) {
    .km-cart__link {
        padding: 0;
        gap: 0;
        background: transparent;
        border-radius: 0;
    }

    .km-cart__icon {
        width: auto;
        height: auto;
        min-width: auto;
        background-color: transparent;
        border-radius: 0;
    }

    .km-cart__content {
        display: none;
    }

    .km-cart__badge {
        top: -6px;
        right: -10px;
        min-width: 18px;
        height: 18px;
        color: #fff;
        font-size: 11px;
        background: #BE9E67;
    }

    .km-cart__dropdown {
        display: none !important;
    }
}