/**
 * Searchable Table
 * Semua selector di-prefix .st- supaya tidak bentrok dengan
 * style template (style.css, responsive.css, bootstrap, dll).
 */

/* Container utama yang di-inject sebelum <table> */
.st-wrap {
    margin: 20px 0 30px 0;
    font-family: inherit;
}

/* ---------- Form pencarian ---------- */
.st-form {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 12px;
    padding: 18px;
    background: #f7f9fc;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* Saat mobile, kategori turun ke bawah input */
@media (max-width: 640px) {
    .st-form {
        grid-template-columns: 1fr;
    }
}

.st-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.st-input-group .st-icon {
    position: absolute;
    left: 14px;
    color: #8a96a3;
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}

.st-search,
.st-category {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    font-size: 14px;
    color: #2c3e50;
    background: #ffffff;
    border: 1px solid #d8dee6;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.st-search {
    padding-left: 38px;
}

.st-search:focus,
.st-category:focus {
    border-color: #f47523;
    box-shadow: 0 0 0 3px rgba(244, 117, 35, 0.12);
}

.st-category {
    cursor: pointer;
    /* Tambahkan panah dropdown custom karena appearance:none butuh fallback */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ---------- Baris info + tombol reset ---------- */
.st-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    margin-bottom: 12px;
    font-size: 13px;
}

.st-info {
    color: #5a6876;
}

.st-reset {
    background: none;
    border: none;
    color: #f47523;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.st-reset:hover {
    background: rgba(244, 117, 35, 0.08);
    text-decoration: underline;
}

/* ---------- Placeholder sebelum pencarian ---------- */
.st-hint {
    padding: 48px 20px;
    text-align: center;
    background: #ffffff;
    border: 1px dashed #d8dee6;
    border-radius: 8px;
    color: #8a96a3;
}

.st-hint i {
    font-size: 36px;
    color: #c5cdd6;
    margin-bottom: 12px;
    display: block;
}

.st-hint p {
    margin: 0;
    font-size: 15px;
}

/* ---------- Empty state (tidak ada hasil) ---------- */
.st-empty {
    padding: 32px 20px;
    text-align: center;
    background: #fff8f1;
    border: 1px solid #f5d9c2;
    border-radius: 8px;
    color: #8a5a2b;
    font-size: 14px;
}

/* ---------- Tabel hasil ---------- */
/* Override minimal supaya rapi, tidak memaksakan style global */
table.st-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    overflow: hidden;
    font-size: 14px;
}

table.st-table thead th {
    background: #f3faf3;
    color: #3c4858;
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #e3e8ef;
}

table.st-table tbody td {
    padding: 12px 14px;
    border-top: 1px solid #eef1f5;
    vertical-align: top;
    color: #2c3e50;
}

table.st-table tbody tr:hover td {
    background: #f9fbfd;
}

table.st-table tbody tr:first-child td {
    border-top: none;
}

table.st-table a {
    color: #f47523;
    text-decoration: none;
}

table.st-table a:hover {
    text-decoration: underline;
}

/* Scroll horizontal otomatis untuk tabel lebar di mobile.
   Tidak bisa dibungkus wrapper dari JS karena table sudah di-wrap
   oleh .st-wrap — solusinya pakai display block + overflow di mobile. */
@media (max-width: 640px) {
    table.st-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}