/* ═══════════════════════════════════════════════
   WC Mix & Match - Product Page Form
   ═══════════════════════════════════════════════ */

.wc-mix-match-form {
    margin: 1.5em 0;
    font-family: inherit;
}

/* ── Header ── */
.mix-match-header h3 {
    margin: 0 0 0.3em;
    font-size: 1.25em;
    font-weight: 700;
}

.mix-match-subtitle {
    color: #666;
    font-size: 0.9em;
    margin: 0 0 1.2em;
}

/* ── Variation rows ── */
.mix-match-variations {
    display: flex;
    flex-direction: column;
    gap: 0.75em;
    margin-bottom: 1.5em;
}

.mix-match-variation-row {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 0.85em 1em;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mix-match-variation-row.has-qty {
    border-color: #4caf50;
    background: #f1f8e9;
    box-shadow: 0 0 0 1px #4caf5033;
}

.mix-match-var-image {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.mix-match-var-info {
    flex: 1;
    min-width: 0;
}

.mix-match-var-label {
    font-weight: 600;
    font-size: 0.95em;
    margin: 0 0 0.15em;
}

.mix-match-var-meta {
    display: flex;
    gap: 0.75em;
    font-size: 0.8em;
    color: #888;
}

.mix-match-var-sku {
    color: #aaa;
}

.mix-match-var-price {
    font-weight: 600;
    color: #333;
}

.mix-match-var-subtotal {
    font-size: 0.8em;
    color: #4caf50;
    font-weight: 600;
    margin-top: 0.15em;
    visibility: hidden;
    height: 1.3em;
}

.mix-match-variation-row.has-qty .mix-match-var-subtotal {
    visibility: visible;
}

/* ── Quantity Controls ── */
.mix-match-qty-controls {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.mix-match-qty-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 1.2em;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: #333;
    user-select: none;
    line-height: 1;
    padding: 0;
}

.mix-match-qty-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.mix-match-qty-btn:active {
    background: #e0e0e0;
}

.mix-match-qty-btn.minus {
    border-radius: 6px 0 0 6px;
}

.mix-match-qty-btn.plus {
    border-radius: 0 6px 6px 0;
}

.mix-match-qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.mix-match-qty-input {
    width: 48px;
    height: 36px;
    border: 1px solid #ccc;
    border-left: none;
    border-right: none;
    text-align: center;
    font-size: 1em;
    font-weight: 600;
    -moz-appearance: textfield;
    appearance: textfield;
    margin: 0;
    padding: 0;
}

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

/* ── Footer ── */
.mix-match-footer {
    border-top: 2px solid #eee;
    padding-top: 1.2em;
}

/* ── Progress Bar ── */
.mix-match-progress {
    margin-bottom: 1em;
}

.progress-bar {
    height: 10px;
    background: #e8e8e8;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.4em;
}

.progress-fill {
    height: 100%;
    background: #ff9800;
    border-radius: 5px;
    transition: width 0.3s ease, background-color 0.3s;
    width: 0%;
}

.progress-fill.complete {
    background: #4caf50;
}

.progress-fill.over {
    background: #f44336;
}

.progress-text {
    font-size: 0.85em;
    color: #666;
    text-align: right;
}

.progress-text .current-total {
    font-weight: 700;
    color: #333;
}

.progress-text.valid .current-total {
    color: #4caf50;
}

.progress-text.invalid .current-total {
    color: #f44336;
}

/* ── Total Price ── */
.mix-match-total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
    font-size: 1.15em;
}

.total-label {
    font-weight: 600;
}

.total-amount {
    font-weight: 700;
    font-size: 1.2em;
    color: #333;
}

/* ── Add to Cart Button ── */
#mix-match-add-to-cart {
    width: 100%;
    padding: 0.85em;
    font-size: 1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: opacity 0.2s, background-color 0.2s;
}

#mix-match-add-to-cart.disabled,
#mix-match-add-to-cart:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#mix-match-add-to-cart.loading {
    pointer-events: none;
    position: relative;
}

#mix-match-add-to-cart.loading::after {
    content: '';
    position: absolute;
    right: 1em;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mm-spin 0.6s linear infinite;
}

@keyframes mm-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* ── Messages ── */
.mix-match-message {
    margin-top: 0.75em;
    padding: 0.6em 0.85em;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
}

.mix-match-message.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.mix-match-message.error {
    background: #fbe9e7;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .mix-match-variation-row {
        flex-wrap: wrap;
        gap: 0.5em;
    }

    .mix-match-var-image {
        width: 40px;
        height: 40px;
    }

    .mix-match-var-info {
        flex: 1 1 calc(100% - 56px);
    }

    .mix-match-qty-controls {
        margin-left: auto;
    }
}

/* ── Cart: Locked Quantity ── */
.mm-locked-qty {
    display: inline-block;
    font-weight: 600;
    font-size: 1em;
    min-width: 2em;
    text-align: center;
}
