/**
 * THI Inventory — Frontend Styles
 * Compatible with WPBakery and most WordPress themes via scoped selectors.
 */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
#thi-inventory-wrapper {
    font-family: inherit;
    color: inherit;
    max-width: 100%;
}

/* ── Filter Bar ──────────────────────────────────────────────────────────── */
.thi-inv-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #dde1e7;
    border-radius: 6px;
}

.thi-inv-filter-bar select,
.thi-inv-filter-bar input[type="text"] {
    padding: 7px 10px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    min-width: 130px;
}

.thi-inv-filter-bar select:focus,
.thi-inv-filter-bar input[type="text"]:focus {
    outline: 2px solid #2271b1;
    border-color: #2271b1;
}

.thi-inv-search-wrap input {
    min-width: 220px !important;
}

.thi-inv-filter-check label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.thi-inv-clear-filters {
    padding: 7px 14px;
    background: transparent;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    color: #50575e;
}
.thi-inv-clear-filters:hover {
    background: #f0f0f0;
}

/* ── Loading state ──────────────────────────────────────────────────────── */
#thi-inventory-results.thi-inv-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* ── Count ──────────────────────────────────────────────────────────────── */
.thi-inv-count {
    margin-bottom: 10px;
    font-size: 13px;
    color: #646970;
}

/* ── Table ──────────────────────────────────────────────────────────────── */
.thi-inv-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #dde1e7;
    border-radius: 6px;
}

.thi-inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 900px;
}

.thi-inv-table thead tr {
    background: #1b2e4a;
    color: #fff;
}

.thi-inv-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.thi-inv-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #eef0f2;
    vertical-align: middle;
    color: #1d2327;
}

.thi-inv-table tbody tr:hover {
    background: #f6f8fb;
}

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

/* Featured rows */
.thi-inv-featured {
    background: #fef9ee !important;
    border-left: 3px solid #c8944a;
}

/* Specific column widths */
.thi-col-od,
.thi-col-weight,
.thi-col-wall {
    font-weight: 600;
    min-width: 55px;
}

.thi-col-ksi {
    min-width: 55px;
}

.thi-col-grade {
    min-width: 60px;
}

.thi-col-thread {
    min-width: 60px;
}

.thi-col-notes {
    max-width: 200px;
    color: #646970;
    font-style: italic;
    font-size: 12px;
}

.thi-col-mill {
    min-width: 90px;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.thi-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
}

.thi-badge-yes {
    background: #d1e7dd;
    color: #0a5c36;
}

.thi-badge-no {
    background: #f8d7da;
    color: #842029;
}

/* ── Empty / Error ───────────────────────────────────────────────────────── */
.thi-inv-empty,
.thi-inv-error {
    padding: 40px 20px;
    text-align: center;
    color: #646970;
    font-size: 15px;
    border: 1px solid #dde1e7;
    border-radius: 6px;
    background: #f8f9fa;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.thi-inv-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
}

.thi-inv-pagination button {
    padding: 8px 18px;
    border: 1px solid #c8944a;
    border-radius: 4px;
    background: #c8944a;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.thi-inv-pagination button:hover:not([disabled]) {
    background: #b07a35;
}

.thi-inv-pagination button[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.thi-inv-page-info {
    font-size: 13px;
    color: #646970;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media ( max-width: 768px ) {
    .thi-inv-filter-bar {
        gap: 8px;
    }

    .thi-inv-filter-bar select,
    .thi-inv-filter-bar input[type="text"] {
        min-width: 100px;
        font-size: 13px;
    }

    .thi-inv-table {
        font-size: 12px;
    }

    .thi-inv-table th,
    .thi-inv-table td {
        padding: 7px 8px;
    }
}
