/* ── Root tokens ────────────────────────────────────────────────────────── */
.wec-cart {
    --wec-orange:       #F58720;
    --wec-orange-dark:  #D96A10;
    --wec-bg-page:      #F7F5F2;
    --wec-bg-card:      #F7F5F2;
    --wec-bg-white:     #FFFFFF;
    --wec-text:         #1E1633;
    --wec-muted:        #999999;
    --wec-border:       #E8E4DF;
    --wec-radius-pill:  999px;
    --wec-radius-card:  16px;
    --wec-radius-btn:   12px;
    --wec-thumb:        72px;
    --wec-transition:   150ms ease;

    position:    relative;
    background:  var(--wec-bg-page);
    color:       var(--wec-text);
    font-size:   15px;
    -webkit-font-smoothing: antialiased;
}

/* ── Inner wrapper ───────────────────────────────────────────────────────── */
.wec-inner {
    padding: 0 0 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING OVERLAY
═══════════════════════════════════════════════════════════════════════════ */

.wec-overlay {
    display:          none;
    position:         absolute;
    inset:            0;
    z-index:          50;
    background:       rgba(240, 237, 232, 0.6);
    backdrop-filter:  blur(1px);
    border-radius:    var(--wec-radius-card);
    align-items:      flex-start;
    justify-content:  center;
    padding-top:      80px;
}

.wec-cart[data-loading="true"] .wec-overlay {
    display: flex;
}

.wec-cart[data-loading="true"] .wec-inner {
    pointer-events: none;
    user-select:    none;
}

.wec-spinner-wrap {
    width:  40px;
    height: 40px;
}

.wec-spinner {
    width:       100%;
    height:      100%;
    border:      3px solid rgba(240,124,30,0.25);
    border-top-color: var(--wec-orange);
    border-radius: 50%;
    animation:   wec-spin 0.65s linear infinite;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   ITEMS LIST
═══════════════════════════════════════════════════════════════════════════ */

.wec-items {
    list-style: none;
    margin:     0;
    padding:    0;
    height: 350px;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* ── Single item ─────────────────────────────────────────────────────────── */
.wec-item {
    display:        flex;
    align-items:    center;
    gap:            14px;
    padding: 16px 14px;
    border-bottom:  1px solid var(--wec-border);
    position:       relative;
    transition:     opacity var(--wec-transition);
}

/* When item is being updated via AJAX */
.wec-item.wec-updating .wec-body,
.wec-item.wec-updating .wec-thumb {
    opacity: 0.35;
}

.wec-item.wec-updating .wec-item-loading {
    display: flex;
}

/* ── Thumbnail ───────────────────────────────────────────────────────────── */
.wec-thumb {
    flex-shrink:   0;
    width:         var(--wec-thumb);
    height:        var(--wec-thumb);
    border-radius: var(--wec-radius-btn);
    overflow:      hidden;
    background:    var(--wec-bg-white);
    display: none;
}

.wec-thumb img,
.wec-thumb-img {
    width:      100%;
    height:     100%;
    object-fit: contain;
    display:    block;
    padding:    4px;
    box-sizing: border-box;
}

/* ── Body ────────────────────────────────────────────────────────────────── */
.wec-body {
    flex:        1 1 auto;
    min-width:   0;
    display:     flex;
    flex-direction: column;
    gap:         6px;
}

.wec-top-row {
    display:         flex;
    justify-content: space-between;
    align-items:     flex-start;
    gap:             8px;
}

.wec-name {
    font-size:   14px;
    font-weight: 700;
    color:       var(--wec-text);
    line-height: 1.3;
    flex:        1;
}

.wec-price {
    font-size:   15px;
    font-weight: 700;
    color:       var(--wec-text);
    white-space: nowrap;
    flex-shrink: 0;
}

.wec-attrs {
    margin:    0;
    font-size: 12px;
    color:     var(--wec-muted);
}

.wec-bottom-row {
    display:         flex;
    justify-content: space-between;
    align-items:     center;
    gap:             8px;
}

.wec-note {
    font-size: 13px;
    color:     var(--wec-muted);
}

/* ── Quantity pill ───────────────────────────────────────────────────────── */
.wec-qty {
    display:         flex;
    align-items:     center;
    background:      var(--wec-orange);
    border-radius:   var(--wec-radius-pill);
    padding:         3px;
    gap:             2px;
    flex-shrink:     0;
    height:          38px;
}

.wec-btn {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           32px;
    height:          32px;
    border-radius:   50%;
    border:          none;
    background:      transparent;
    color:           #ffffff;
    cursor:          pointer;
    padding:         0;
    transition:      background var(--wec-transition), transform var(--wec-transition);
    flex-shrink:     0;
}

.wec-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.wec-btn:active {
    transform: scale(0.9);
}

/* Trash icon */
.wec-btn-remove svg,
.wec-btn-plus svg {
    width:  16px;
    height: 16px;
    stroke: #ffffff;
    fill:   none;
}

/* Minus text */
.wec-btn-minus {
    font-size:   22px;
    font-weight: 400;
    line-height: 1;
    color:       #ffffff;
    padding-bottom: 2px; /* optical align */
}

.wec-qty-num {
    min-width:   26px;
    text-align:  center;
    font-size:   15px;
    font-weight: 700;
    color:       #ffffff;
    font-family: var(--wec-font);
    user-select: none;
}

/* ── Per-item loading state (spinner + "Wird aktualisiert…") ─────────────── */
.wec-item-loading {
    display:         none;  /* shown via .wec-updating */
    position:        absolute;
    inset:           0;
    align-items:     center;
    justify-content: center;
    gap:             10px;
    border-radius:   var(--wec-radius-card);
    pointer-events:  none;
}

.wec-item-spinner {
    width:        20px;
    height:       20px;
    border:       2px solid rgba(240,124,30,0.3);
    border-top-color: var(--wec-orange);
    border-radius: 50%;
    animation:    wec-spin 0.6s linear infinite;
    flex-shrink:  0;
}

.wec-item-updating {
    font-size:   13px;
    font-weight: 600;
    color:       var(--wec-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOTALS BLOCK
═══════════════════════════════════════════════════════════════════════════ */

.wec-totals {
    padding:    20px 0 12px;
    display:    flex;
    flex-direction: column;
    gap:        8px;
}

.wec-row {
    display:         flex;
    justify-content: space-between;
    align-items:     baseline;
    gap:             12px;
}

.wec-row-label,
.wec-row-value {
    font-size:   14px;
    font-weight: 500;
    color:       var(--wec-text);
}

/* Total row */
.wec-row--total .wec-row-label,
.wec-row--total .wec-row-value {
    font-size:   17px;
    font-weight: 800;
}

.wec-divider {
    height:        1px;
    background:    var(--wec-border);
    margin:        6px 0;
}

.wec-muted {
    color:     var(--wec-muted);
    font-size: 13px;
}

/* ── Checkout button ─────────────────────────────────────────────────────── */
.wec-checkout-btn {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             4px;
    width:           100%;
    padding:         18px 24px;
    background:      var(--wec-orange);
    color:           #ffffff;
    font-family:     var(--wec-font);
    font-size:       16px;
    font-weight:     800;
    border-radius:   var(--wec-radius-pill);
    text-decoration: none;
    box-sizing:      border-box;
    transition:      background var(--wec-transition), transform var(--wec-transition);
    margin-top:      8px;
    letter-spacing:  0.01em;
}

.wec-checkout-btn:hover {
    background:      var(--wec-orange-dark);
    color:           #ffffff;
    text-decoration: none;
}

.wec-checkout-btn:active {
    transform: scale(0.98);
}

.wec-checkout-total {
    font-weight: 800;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════════════════════ */

.wec-empty {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    padding:         60px 20px;
    gap:             12px;
    text-align:      center;
}

.wec-empty-icon svg {
    width:  56px;
    height: 56px;
    stroke: var(--wec-muted);
}

.wec-empty-title {
    margin:      0;
    font-size:   16px;
    font-weight: 800;
    color:       var(--wec-text);
}

.wec-empty-desc {
    margin:    0;
    font-size: 13px;
    color:     var(--wec-muted);
    max-width: 220px;
    line-height: 1.55;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 400px) {
    .wec-cart { --wec-thumb: 60px; }
    .wec-name { font-size: 13px; }
    .wec-price { font-size: 13px; }
}
