/* Compact Modern Cart Styles with Local Hind Font */
:root {
    --cart-success: #4FB9B0;
    --cart-success-hover: #33827B; /* dunkler für AA-Kontrast (Weiß darauf ≥ 4.5:1) */
    --cart-error: #AF1917;
    --cart-border: #e2e8f0;        /* Baseline-Border; wichtige Komponenten härten wir gezielt */
    --cart-border-strong: #64748b; /* sichtbare UI-Grenzen (≥ 3:1) */
    --cart-text: #1a202c;
    --cart-text-light: #718096;
    --cart-radius: 0;
    --cart-transition: all 0.2s ease;
    --focus-outline: #000;         /* klar sichtbarer Fokus */
}

/* Base Styles */
* {
    font-family: 'Hind', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.cart-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Lists */
ul.wp-block-warenkorb-block-cart-no-prices,
.cart-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Loading */
.cart-loading {
    text-align: center;
    padding: 2rem;
    color: var(--cart-text-light);
}

.cart-loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--cart-border);
    border-top: 2px solid var(--cart-text-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty/Error States */
.cart-empty,
.cart-error {
    text-align: center;
    padding: 2rem;
}

.cart-error {
    border-color: var(--cart-error);
    color: var(--cart-error);
}

/* Messages */
.cart-message {
    padding: 0.75rem 1rem;
    border-radius: var(--cart-radius);
    margin-bottom: 1rem;
    border-left: 4px solid;
    transition: var(--cart-transition);
}

.cart-message--success {
    background: #e6f8f6;
    border-color: var(--cart-success);
    color: #29605b;
}

.cart-message--error {
    background: #fef2f2;
    border-color: var(--cart-error);
    color: var(--cart-error);
}

/* Cart Items */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--cart-border);
    transition: var(--cart-transition);
}

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

.cart-item-left {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.cart-item-image {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--cart-radius);
    flex-shrink: 0;
    border: 1px solid var(--cart-border-strong); /* AA: sichtbarer Rahmen */
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--cart-text);
    line-height: 1.4;
}

.cart-item-sku {
    font-size: 0.875rem;
    color: #000;
    margin-bottom: 0.5rem;
    font-family: 'Hind', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.cart-item-sku strong {
    font-weight: 400;
    font-family: inherit;
}

.cart-item-attributes {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
    color: #000;
}

.cart-item-attributes li {
    margin-bottom: 0.25rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--cart-border-strong); /* AA: sichtbarer Rahmen */
    border-radius: 4px;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Controls */
.cart-item-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    min-width: 140px;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Quantity Controls */
.cart-item-quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid var(--cart-border-strong); /* AA: sichtbarer Rahmen */
    border-radius: var(--cart-radius);
    overflow: hidden;
}

.cart-qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #000;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--cart-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.cart-qty-btn:hover:not(:disabled) {
    background: #333;
}

.cart-qty-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cart-qty-btn:focus,
.cart-qty-btn:focus-visible {
    outline: 2px solid var(--focus-outline);
    outline-offset: 2px;
}

.cart-item-qty-input {
    width: 60px;
    height: 36px;
    padding: 0;
    border: none;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    background: white;
    color: var(--cart-text);
    outline: none;
    -moz-appearance: textfield;
}

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

.cart-item-qty-input:focus,
.cart-item-qty-input:focus-visible {
    outline: 2px solid var(--focus-outline);
    outline-offset: -2px;
}

.cart-item-qty-input.loading {
    opacity: 0.6;
    pointer-events: none;
}

.cart-item-qty-input.updated {
    background: var(--cart-success);
    color: white;
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.cart-item-quantity-controls.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Remove Button */
.cart-item-remove {
    background: var(--cart-error);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    border-radius: var(--cart-radius);
    transition: var(--cart-transition);
}

.cart-item-remove:hover {
    background: #8b1412;
}

.cart-item-remove:focus,
.cart-item-remove:focus-visible {
    outline: 2px solid var(--focus-outline); /* statt rotem Outline: klar sichtbar */
    outline-offset: 2px;
}

/* Checkout Buttons + Portfolio */
.cart-checkout-button-container {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--cart-border);
    text-align: center;
}

.cart-checkout-button {
    display: inline-block;
    background: #000;
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: var(--cart-radius);
    font-weight: 400;
    font-size: 1rem;
    transition: var(--cart-transition);
    border: none;
    cursor: pointer;
    min-width: 200px;
}

.cart-checkout-button:hover {
    background: var(--cart-success-hover); /* AA-konform bei weißem Text */
    color: #fff;
    text-decoration: none;
}

.cart-checkout-button:focus,
.cart-checkout-button:focus-visible {
    outline: 2px solid var(--focus-outline);
    outline-offset: 2px;
}

.cart-portfolio-button {
    background: #fff;
    color: #000;
    border: 1px solid #000;
    padding: 0.8rem 1.2rem;
    text-decoration: none;
    border-radius: 0;
    font-family: 'Hind', sans-serif;
}

.cart-portfolio-button:hover {
    background: #f5f5f5;
}

.cart-portfolio-button:focus,
.cart-portfolio-button:focus-visible {
    outline: 2px solid var(--focus-outline);
    outline-offset: 2px;
}

/* Editor Preview */
.cart-preview-notice {
    border: 1px dashed var(--cart-border);
    border-radius: var(--cart-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--cart-text-light);
    font-style: italic;
}

.cart-preview .cart-item-controls input,
.cart-preview .cart-item-controls button {
    pointer-events: none;
    opacity: 0.7;
}

/* Legacy Editor Styles (can be removed if not needed) */
.cart-item-image.placeholder {
    width: 50px;
    height: 50px;
    background: #ddd;
}

.cart-item-qty {
    font-weight: 600;
}

/* Two-buttons layout in footer */
.cart-checkout-button-container {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 768px) {
    .cart-item {
        flex-direction: column;
        gap: 1rem;
    }

    .cart-item-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        min-width: 100%;
        gap: 1rem;
    }

    .cart-checkout-button {
        width: 80%;
    }
}

@media (max-width: 480px) {
    .cart-item-left {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
    }

    .cart-item-image {
        width: 60px;
        height: 45px;
    }

    .cart-item-attributes li {
        display: block;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }

    .cart-item-controls {
        flex-direction: column;
        gap: 0.75rem;
    }

    .cart-checkout-button {
        width: calc(100% - 2rem);
        margin: 0 1rem;
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
        word-wrap: break-word;
        line-height: 1.2;
    }

    .cart-checkout-button-container {
        padding-left: 0;
        padding-right: 0;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print */
@media print {
    .cart-item-controls,
    .cart-checkout-button-container,
    .cart-message {
        display: none;
    }
}
