/**
 * Walttools Order Table — Styles
 * Scoped to .wot-* to avoid theme collisions.
 */

/* ============================================================
   RESET / BASE
   ============================================================ */
#wot-app {
    font-family: inherit;
    font-size: 14px;
    color: #1e1e1e;
    line-height: 1.5;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    overflow-x: hidden;
}

#wot-app *, #wot-app *::before, #wot-app *::after {
    box-sizing: border-box;
}

.wot-loading {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 15px;
}

/* ============================================================
   LAYOUT — main table + cart builder sidebar
   ============================================================ */
.wot-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.wot-main {
    flex: 1;
    min-width: 0;
}

.wot-sidebar {
    flex: 0 0 300px;
    position: sticky;
    top: 40px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

@media (max-width: 960px) {
    .wot-layout {
        flex-direction: column;
    }
    .wot-sidebar {
        flex: none;
        width: 100%;
        position: static;
        max-height: none;
    }
}

/* ============================================================
   ADMIN: CUSTOMER SELECTOR
   ============================================================ */
.wot-customer-selector {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.wot-customer-selector h3 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #444;
}

.wot-customer-search-wrap {
    position: relative;
}

.wot-customer-search {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.wot-customer-search:focus {
    border-color: #D67620;
    box-shadow: 0 0 0 2px rgba(214, 118, 32, 0.15);
}

.wot-customer-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.wot-customer-results.is-open {
    display: block;
}

.wot-customer-result {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
}

.wot-customer-result:hover {
    background: #fef6ed;
}

.wot-customer-result:last-child {
    border-bottom: none;
}

.wot-customer-result-name {
    font-weight: 600;
    color: #1e1e1e;
}

.wot-customer-result-email {
    font-size: 12px;
    color: #888;
}

.wot-customer-selected {
    display: none;
    margin-top: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #D67620;
    border-radius: 6px;
}

.wot-customer-selected.is-visible {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.wot-customer-selected-info {
    flex: 1;
}

.wot-customer-selected-name {
    font-weight: 700;
    font-size: 15px;
    color: #1e1e1e;
    margin-bottom: 2px;
}

.wot-customer-selected-detail {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
}

.wot-customer-clear {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #666;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}

.wot-customer-clear:hover {
    border-color: #c0392b;
    color: #c0392b;
}

/* ============================================================
   SPECIAL ITEM BUTTONS + FORMS (admin only)
   ============================================================ */
.wot-special-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.wot-special-btn {
    padding: 8px 14px;
    background: #1e1e1e;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.15s;
}

.wot-special-btn:hover {
    background: #333;
}

.wot-special-form {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.wot-special-form-title {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #444;
    margin-bottom: 10px;
}

.wot-special-form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.wot-special-input {
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    outline: none;
    width: 120px;
}

.wot-special-input:focus {
    border-color: #D67620;
}

.wot-special-input.wot-special-wide {
    flex: 1;
    min-width: 200px;
    width: auto;
}

.wot-special-input.wot-special-qty {
    width: 60px;
    text-align: center;
}

.wot-special-textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    outline: none;
    resize: vertical;
    min-height: 50px;
    max-height: 120px;
    margin-bottom: 8px;
    font-family: inherit;
}

.wot-special-textarea:focus {
    border-color: #D67620;
}

.wot-radio-label {
    font-size: 12px;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wot-radio-label input[type="radio"] {
    margin: 0;
}

.wot-special-form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wot-special-form-actions .wot-add-btn {
    padding: 7px 16px;
}

.wot-special-cancel {
    padding: 7px 14px;
    background: none;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: border-color 0.15s;
}

.wot-special-cancel:hover {
    border-color: #999;
}

/* Cart item note display */
.wot-cart-item-note {
    font-size: 11px;
    color: #D67620;
    font-style: italic;
    margin-top: 2px;
}

/* ============================================================
   SEARCH + FILTERS BAR
   ============================================================ */
.wot-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.wot-search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.wot-search-input:focus {
    border-color: #D67620;
    box-shadow: 0 0 0 2px rgba(214, 118, 32, 0.15);
}

.wot-search-input::placeholder {
    color: #aaa;
}

.wot-result-count {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
}

/* ============================================================
   PRODUCT TABLE
   ============================================================ */
.wot-table-wrap {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    background: #fff;
}

.wot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
    min-width: 600px;
}

.wot-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.wot-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
    white-space: nowrap;
}

/* Fixed column widths to prevent layout shift */
.wot-table th:first-child,
.wot-table td:first-child {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
}

.wot-table th:last-child,
.wot-table td:last-child {
    width: 130px;
}

.wot-table td {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.wot-table tbody tr:hover {
    background: #fefaf5;
}

.wot-table tbody tr:last-child td {
    border-bottom: none;
}

/* Image cell — strictly square */
.wot-cell-image {
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    padding: 8px 4px 8px 8px !important;
}

.wot-cell-image img {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    max-width: 48px;
    max-height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
    display: block;
}

/* Name cell — includes product name, variation label, and SKU */
.wot-cell-name {
    min-width: 140px;
    max-width: 340px;
    overflow: hidden;
}

.wot-product-name {
    font-weight: 600;
    color: #1e1e1e;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.wot-variation-label {
    font-size: 12px;
    color: #888;
    margin-top: 1px;
}

.wot-product-sku {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    letter-spacing: 0.02em;
}

/* Price cells */
.wot-cell-price {
    white-space: nowrap;
    font-weight: 600;
}

.wot-price-retail {
    color: #1e1e1e;
}

.wot-price-distributor {
    color: #D67620;
}

.wot-price-na {
    color: #ccc;
    font-weight: 400;
    font-style: italic;
}

/* Qty + Add cell */
.wot-cell-action {
    white-space: nowrap;
}

.wot-qty-add-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.wot-qty-input {
    width: 54px;
    padding: 6px 4px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    -moz-appearance: textfield;
}

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

.wot-qty-input:focus {
    border-color: #D67620;
}

.wot-add-btn {
    padding: 6px 12px;
    background: #D67620;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}

.wot-add-btn:hover {
    background: #b8651a;
}

.wot-add-btn:active {
    transform: scale(0.97);
}

.wot-add-btn.is-added {
    background: #3a9c3a;
    pointer-events: none;
}

/* Admin price override */
.wot-cell-override {
    white-space: nowrap;
}

.wot-override-input {
    width: 72px;
    padding: 6px 4px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    background: #fff;
    transition: border-color 0.15s;
}

.wot-override-input:focus {
    border-color: #D67620;
    background: #fffbe6;
}

.wot-override-input::placeholder {
    color: #ccc;
    font-size: 11px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.wot-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid #eee;
}

.wot-page-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    color: #444;
    transition: border-color 0.15s, background 0.15s;
}

.wot-page-btn:hover:not(:disabled) {
    border-color: #D67620;
    color: #D67620;
}

.wot-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.wot-page-btn.is-current {
    background: #D67620;
    border-color: #D67620;
    color: #fff;
    font-weight: 700;
}

.wot-page-info {
    font-size: 13px;
    color: #888;
}

/* ============================================================
   CART BUILDER (sidebar)
   ============================================================ */
.wot-cart-builder {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.wot-cart-header {
    background: #1e1e1e;
    color: #fff;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wot-cart-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wot-cart-count {
    background: #D67620;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.wot-cart-clear {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.6);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.wot-cart-clear:hover {
    border-color: #c0392b;
    color: #fff;
}

.wot-cart-items {
    max-height: 400px;
    overflow-y: auto;
}

.wot-cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
    font-size: 14px;
}

.wot-cart-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

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

.wot-cart-item-info {
    flex: 1;
    min-width: 0;
}

.wot-cart-item-name {
    font-weight: 600;
    font-size: 13px;
    color: #1e1e1e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wot-cart-item-sku {
    font-size: 10px;
    color: #999;
}

.wot-cart-item-variation {
    font-size: 11px;
    color: #888;
}

.wot-cart-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    flex-wrap: wrap;
}

.wot-cart-item-qty {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wot-cart-item-qty button {
    width: 22px;
    height: 22px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f8f8f8;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #444;
    line-height: 1;
    transition: border-color 0.15s;
}

.wot-cart-item-qty button:hover {
    border-color: #D67620;
    color: #D67620;
}

/* Editable qty input in cart builder */
.wot-cart-qty-input {
    width: 36px;
    text-align: center;
    font-weight: 700;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px;
    outline: none;
    -moz-appearance: textfield;
}

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

.wot-cart-qty-input:focus {
    border-color: #D67620;
}

/* Editable price input in cart builder */
.wot-cart-item-price-wrap {
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: #1e1e1e;
    gap: 1px;
}

.wot-cart-price-input {
    width: 55px;
    text-align: right;
    font-weight: 600;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px 4px;
    outline: none;
}

.wot-cart-price-input:focus {
    border-color: #D67620;
    background: #fffbe6;
}

/* Line total in cart builder */
.wot-cart-item-line-total {
    font-weight: 600;
    color: #1e1e1e;
    white-space: nowrap;
    font-size: 12px;
    margin-left: auto;
}

.wot-cart-item-remove {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 8px;
    line-height: 1;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    flex-shrink: 0;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wot-cart-item-remove:hover {
    color: #c0392b;
    border-color: #c0392b;
    background: #fef0f0;
}

/* Cart footer */
.wot-cart-footer {
    border-top: 2px solid #e0e0e0;
    padding: 16px;
}

.wot-cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 0 2px;
}

.wot-cart-total-label {
    color: #444;
}

.wot-cart-total-value {
    color: #1e1e1e;
}

.wot-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wot-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.wot-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wot-btn:active:not(:disabled) {
    transform: scale(0.98);
}

/* Primary — Go to Checkout / Pay Now */
.wot-btn-primary {
    background: #D67620;
    color: #fff;
}

.wot-btn-primary:hover:not(:disabled) {
    background: #b8651a;
}

/* Secondary — Add to Cart (keep shopping) */
.wot-btn-secondary {
    background: #fff;
    color: #D67620;
    border: 1.5px solid #D67620;
}

.wot-btn-secondary:hover:not(:disabled) {
    background: #fef6ed;
}

/* Tertiary — On Hold / Purchase Order */
.wot-btn-tertiary {
    background: #f0f0f0;
    color: #444;
    border: 1px solid #ddd;
}

.wot-btn-tertiary:hover:not(:disabled) {
    background: #e8e8e8;
    border-color: #ccc;
}

/* Success state */
.wot-btn.is-success {
    background: #3a9c3a !important;
    color: #fff !important;
    border-color: #3a9c3a !important;
}

/* Admin actions divider */
.wot-admin-actions-divider {
    border: none;
    border-top: 1px dashed #ddd;
    margin: 4px 0;
}

/* ============================================================
   NOTIFICATION TOAST
   ============================================================ */
.wot-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e1e1e;
    color: #fff;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 99999;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    max-width: 360px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.wot-toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.wot-toast.is-error {
    background: #c0392b;
}

.wot-toast.is-success {
    background: #3a9c3a;
}

/* ============================================================
   TABLE LOADING STATE
   ============================================================ */
.wot-table-wrap.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ============================================================
   EMPTY TABLE STATE
   ============================================================ */
.wot-table-empty {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
    font-size: 14px;
}

/* ============================================================
   ORDER CONFIRMATION MODAL
   ============================================================ */
.wot-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    display: none;
    align-items: center;
    justify-content: center;
}

.wot-modal-overlay.is-open {
    display: flex;
}

.wot-modal {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.wot-modal h3 {
    margin: 0 0 8px;
    font-size: 20px;
    color: #1e1e1e;
}

.wot-modal p {
    margin: 0 0 20px;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.wot-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.wot-modal-actions .wot-btn {
    width: auto;
    padding: 10px 24px;
}

/* ============================================================
   FAMILY ROWS + VARIATION GRID
   ============================================================ */
.wot-family-row {
    cursor: pointer;
    transition: background 0.15s;
}

.wot-family-row:hover {
    background: #fef6ed;
}

.wot-family-row.is-expanded {
    background: #f8f4ef;
    border-bottom: none;
}

.wot-family-row.is-expanded td {
    border-bottom: none;
}

.wot-variation-count {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.wot-price-range {
    color: #1e1e1e;
    font-weight: 600;
}

.wot-expand-btn {
    padding: 6px 14px;
    background: #f0f0f0;
    color: #444;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    min-width: 90px;
    text-align: center;
}

.wot-expand-btn:hover {
    background: #e8e8e8;
    border-color: #D67620;
    color: #D67620;
}

/* Variation grid row — full width, no column impact */
.wot-variation-grid-row td {
    padding: 0 !important;
    border-bottom: 1px solid #e0e0e0;
    overflow: hidden;
}

.wot-variation-grid-row td[colspan] {
    width: 100%;
}

.wot-variation-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0;
    background: #fafafa;
    border-top: 1px solid #ddd;
}

.wot-variation-card {
    background: #fff;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: background 0.1s;
}

.wot-variation-card:hover {
    background: #fef6ed;
}

.wot-variation-card:nth-child(8n) {
    border-right: none;
}

.wot-variation-card-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.wot-variation-card-info {
    padding: 4px 6px;
    flex: 1;
    min-height: 0;
}

.wot-variation-card-label {
    font-weight: 600;
    font-size: 13px;
    color: #1e1e1e;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.wot-variation-card-sku {
    font-size: 10px;
    color: #999;
}

/* Native select for secondary attribute */
.wot-var-select {
    display: block;
    width: 100%;
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
    background: #fff;
    margin: 3px 0 2px;
    cursor: pointer;
    outline: none;
}

.wot-var-select:focus {
    border-color: #D67620;
}

/* Price display area */
.wot-variation-card-price {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

/* Admin editable price inputs on variation cards */
.wot-var-price-fields {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 3px;
}

.wot-var-price-row {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
}

.wot-var-price-label {
    color: #888;
    min-width: 24px;
}

.wot-var-price-input {
    width: 100%;
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    outline: none;
    text-align: right;
}

.wot-var-price-input:focus {
    border-color: #D67620;
    background: #fffbe6;
}

.wot-var-price-input-retail {
    color: #1e1e1e;
}

.wot-var-price-input-dist {
    color: #D67620;
}

.wot-variation-card-action {
    padding: 4px 6px 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wot-variation-card-action .wot-qty-input {
    width: 36px;
    padding: 3px 2px;
    font-size: 11px;
}

.wot-variation-card-action .wot-add-btn {
    flex: 1;
    padding: 3px 4px;
    font-size: 10px;
}

/* ============================================================
   TABLET (max-width: 960px)
   ============================================================ */
@media (max-width: 960px) {
    .wot-layout {
        flex-direction: column;
    }

    .wot-sidebar {
        flex: none;
        width: 100%;
        position: static;
        max-height: none;
    }

    .wot-variation-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .wot-variation-card:nth-child(8n) { border-right: 1px solid #e0e0e0; }
    .wot-variation-card:nth-child(4n) { border-right: none; }

    .wot-special-buttons {
        flex-wrap: wrap;
    }
}

/* ============================================================
   MOBILE (max-width: 600px)
   Table becomes card layout
   ============================================================ */
@media (max-width: 600px) {
    #wot-app {
        padding: 0 8px;
    }

    /* Prevent horizontal overflow */
    .wot-table-wrap {
        overflow-x: hidden;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    /* Hide table header on mobile */
    .wot-table thead {
        display: none;
    }

    /* Each row becomes a card */
    .wot-table,
    .wot-table tbody,
    .wot-table tr,
    .wot-table td {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    .wot-table {
        min-width: 0;
        table-layout: auto;
    }

    .wot-table tbody tr {
        border-bottom: 1px solid #e0e0e0;
        padding: 10px;
        position: relative;
    }

    .wot-table tbody tr:hover {
        background: none;
    }

    .wot-table td {
        padding: 0;
        border-bottom: none;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    /* Mobile row layout: image left, title+sku+price right, action below */
    .wot-table tbody tr:not(.wot-variation-grid-row):not(.wot-family-row) {
        display: grid;
        grid-template-columns: 48px 1fr;
        grid-template-rows: auto auto;
        gap: 0 10px;
        align-items: start;
        padding: 10px;
    }

    /* Image — top left */
    .wot-table tbody tr:not(.wot-variation-grid-row) .wot-cell-image {
        grid-row: 1;
        grid-column: 1;
        width: 48px;
        min-width: 48px !important;
        max-width: 48px !important;
        padding: 0 !important;
    }

    /* Name + SKU — top right */
    .wot-table tbody tr:not(.wot-variation-grid-row) .wot-cell-name {
        grid-row: 1;
        grid-column: 2;
        max-width: none !important;
        min-width: 0 !important;
    }

    /* Price — below name, still in right column */
    .wot-table tbody tr:not(.wot-variation-grid-row) .wot-cell-price {
        grid-column: 2;
        text-align: left;
    }

    /* Price range stacks */
    .wot-price-range {
        font-size: 13px;
        word-break: break-word;
    }

    /* Hide override column on mobile */
    .wot-table tbody tr:not(.wot-variation-grid-row) .wot-cell-override {
        display: none;
    }

    /* Qty + Add — bottom row spanning full width */
    .wot-table tbody tr:not(.wot-variation-grid-row) .wot-cell-action {
        grid-column: 1 / -1;
        padding-top: 8px;
    }

    .wot-qty-add-group {
        width: 100%;
        justify-content: flex-start;
    }

    /* Family rows — also card layout */
    .wot-table tbody tr.wot-family-row {
        display: grid;
        grid-template-columns: 48px 1fr;
        grid-template-rows: auto auto auto;
        gap: 0 10px;
        align-items: start;
        padding: 10px;
    }

    .wot-family-row .wot-cell-image {
        grid-row: 1;
        grid-column: 1;
        padding: 0 !important;
    }

    .wot-family-row .wot-cell-name {
        grid-row: 1;
        grid-column: 2;
        max-width: none !important;
    }

    .wot-family-row .wot-cell-price {
        grid-column: 2;
        text-align: left;
    }

    /* Hide empty admin price cells on mobile family row */
    .wot-family-row .wot-cell-price:empty {
        display: none;
    }

    .wot-family-row .wot-cell-action {
        grid-column: 1 / -1;
        padding-top: 8px;
    }

    .wot-expand-btn {
        width: 100%;
    }

    /* Variation grid — 3 columns on mobile */
    .wot-variation-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .wot-variation-card:nth-child(4n) { border-right: 1px solid #e0e0e0; }
    .wot-variation-card:nth-child(3n) { border-right: none; }

    .wot-variation-grid-row,
    .wot-variation-grid-row td {
        display: block;
        width: 100%;
    }

    /* Special buttons wrap */
    .wot-special-buttons {
        flex-wrap: wrap;
    }

    .wot-special-btn {
        flex: 1;
        min-width: calc(50% - 4px);
        text-align: center;
        font-size: 11px;
        padding: 8px 8px;
    }

    /* Customer selector compact */
    .wot-customer-selector {
        padding: 12px;
    }

    /* Cart builder full width */
    .wot-sidebar {
        flex: none;
        width: 100%;
        position: static;
        max-height: none;
    }

    /* Search bar */
    .wot-filters {
        flex-direction: column;
        gap: 8px;
    }

    .wot-search-input {
        min-width: 0;
        width: 100%;
    }

    /* Pagination compact */
    .wot-pagination {
        padding: 12px 8px;
    }
}
