// ==================================
// Cart page + badge header
// Utilise CSS custom properties du theme
// ==================================

// --- Badge header ---
.cart-badge-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 0.25rem;

    &:hover {
        color: var(--primary);
    }
}

.cart-badge-count {
    position: absolute;
    top: -6px;
    right: -8px;
    font-size: 0.65rem;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

// --- Cart page ---
.cart-page {
    min-height: 60vh;
}

.cart-title {
    font-family: var(--font-family-secondary, var(--font-family));
    color: var(--text);
}

// Empty state
.cart-empty {
    &__icon {
        color: var(--text-muted, #6c757d);
        opacity: 0.5;
    }

    &__title {
        font-family: var(--font-family-secondary, var(--font-family));
        color: var(--text);
    }

    &__text {
        max-width: 400px;
        margin: 0 auto;
    }
}

// Table desktop
.cart-table-wrapper {
    background: var(--surface, #fff);
    border-radius: var(--radius, 12px);
    border: 1px solid var(--border, #e5e7eb);
    overflow: hidden;
    margin-bottom: 2rem;
}

.cart-table {
    margin-bottom: 0;

    thead {
        background: var(--bg, #f8f9fa);
    }

    th {
        font-size: 0.8rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted, #6c757d);
        padding: 1rem;
        border-bottom: 1px solid var(--border, #e5e7eb);
    }

    td {
        padding: 1rem;
        vertical-align: middle;
        border-bottom: 1px solid var(--border, #e5e7eb);
    }

    tr:last-child td {
        border-bottom: none;
    }
}

.cart-table__thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: calc(var(--radius, 12px) / 2);
}

.cart-table__thumb-placeholder {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg, #f8f9fa);
    border-radius: calc(var(--radius, 12px) / 2);
    color: var(--text-muted, #6c757d);
}

.cart-table__product-title {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;

    &:hover {
        color: var(--primary);
    }
}

.cart-table__variant {
    font-size: 0.85rem;
}

// Quantity controls
.cart-qty-form {
    white-space: nowrap;
}

.cart-qty-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    border-radius: calc(var(--radius, 12px) / 2);
}

.cart-qty-value {
    min-width: 28px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.cart-remove-btn {
    opacity: 0.5;
    transition: opacity 0.2s ease;
    padding: 0.25rem;

    &:hover {
        opacity: 1;
    }
}

// Mobile cards
.cart-card {
    background: var(--surface, #fff);
    border-radius: var(--radius, 12px);
    border: 1px solid var(--border, #e5e7eb);
    padding: 1rem;
}

.cart-card__thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: calc(var(--radius, 12px) / 2);
    flex-shrink: 0;
}

.cart-card__title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    text-decoration: none;
    display: block;

    &:hover {
        color: var(--primary);
    }
}

.cart-card__variant {
    font-size: 0.8rem;
}

.cart-card__price {
    font-size: 1rem;
    color: var(--primary);
}

// Summary / totals
.cart-summary {
    background: var(--surface, #fff);
    border-radius: var(--radius, 12px);
    border: 1px solid var(--border, #e5e7eb);
    padding: 1.5rem;
    max-width: 420px;
    margin-left: auto;
}

.cart-summary__line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-muted, #6c757d);

    &--total {
        border-top: 2px solid var(--border, #e5e7eb);
        margin-top: 0.5rem;
        padding-top: 1rem;
        color: var(--text);
        font-size: 1.1rem;
    }
}

.cart-summary__total-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.cart-summary__actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;

    .btn-lg {
        flex: 1;
        min-width: 180px;
    }
}

// Product page cart form
.product-info__cart-form {
    width: 100%;
}
