/**
 * ps_bulkordermatrix — Frontend styles
 * All selectors are prefixed with .bom- to avoid collisions with third-party themes.
 */

/* ── Wrapper ─────────────────────────────────────────────────────────── */
.bom-matrix-wrapper {
    margin: 24px 0;
    padding: 20px 22px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
    box-sizing: border-box;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.bom-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.bom-icon {
    display: flex;
    align-items: center;
    color: #555;
    flex-shrink: 0;
}

.bom-icon svg {
    width: 18px;
    height: 18px;
}

.bom-title {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Primary attribute selector ──────────────────────────────────────── */
.bom-primary-selector {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.bom-selector-label {
    font-size: 13px;
    font-weight: 500;
    color: #444;
    flex-shrink: 0;
}

.bom-primary-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bom-primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1.5px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    line-height: 1.4;
}

.bom-primary-btn:hover {
    border-color: #888;
    background: #f5f5f5;
}

.bom-primary-btn--active {
    border-color: #333;
    background: #333;
    color: #fff;
}

.bom-primary-btn--active .bom-swatch {
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #333;
}

/* Color swatches */
.bom-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.bom-swatch--texture {
    background-size: cover;
    background-position: center;
}

/* ── Matrix grid ─────────────────────────────────────────────────────── */
.bom-grid-wrap {
    margin-bottom: 16px;
}

.bom-matrix-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Individual size cell */
.bom-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 70px;
}

.bom-cell-label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-align: center;
    white-space: nowrap;
}

.bom-cell-stock {
    font-size: 11px;
    color: #888;
    text-align: center;
}

.bom-cell-stock--low {
    color: #c0392b;
}

.bom-cell-stock--ok {
    color: #27ae60;
}

.bom-qty-input {
    width: 64px;
    height: 36px;
    text-align: center;
    border: 1.5px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #222;
    background: #fff;
    padding: 0 4px;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    -moz-appearance: textfield;
}

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

.bom-qty-input:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(51,51,51,0.12);
}

.bom-qty-input:disabled,
.bom-cell--unavailable .bom-qty-input {
    background: #f2f2f2;
    color: #bbb;
    border-color: #e0e0e0;
    cursor: not-allowed;
}

.bom-cell--unavailable .bom-cell-label {
    color: #bbb;
}

.bom-cell--unavailable .bom-cell-stock {
    color: #ccc;
}

.bom-grid-empty {
    font-size: 13px;
    color: #888;
    padding: 10px 0;
}

/* ── Footer / CTA ────────────────────────────────────────────────────── */
.bom-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    border-top: 1px solid #f0f0f0;
    padding-top: 14px;
}

.bom-summary {
    font-size: 13px;
    color: #555;
}

.bom-summary-units {
    font-weight: 700;
    color: #222;
    margin-right: 3px;
}

.bom-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    line-height: 1;
}

.bom-add-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.bom-add-btn:hover:not(:disabled) {
    background: #111;
}

.bom-add-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.bom-add-btn--loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ── Feedback messages ───────────────────────────────────────────────── */
.bom-feedback {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
}

.bom-feedback--success {
    background: #eafaf1;
    border: 1px solid #a9dfbf;
    color: #1e8449;
}

.bom-feedback--error {
    background: #fdedec;
    border: 1px solid #f5b7b1;
    color: #c0392b;
}

/* ── Utility ─────────────────────────────────────────────────────────── */
.bom-hidden {
    display: none !important;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .bom-matrix-wrapper {
        padding: 14px 12px 12px;
    }

    .bom-cell {
        min-width: 58px;
    }

    .bom-qty-input {
        width: 54px;
        height: 32px;
        font-size: 13px;
    }

    .bom-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .bom-add-btn {
        width: 100%;
        justify-content: center;
    }
}
