/* =============================================================================
   Responsive Table Widget — base styles
   Per-instance responsive overrides are injected as scoped <style> blocks.
   ============================================================================= */

/* Outer widget wrapper ------------------------------------------------------ */
.rtw-widget-wrapper {
    width: 100%;
    box-sizing: border-box;
}

/* Table wrapper ------------------------------------------------------------- */
.rtw-table-wrapper {
    width: 100%;
    box-sizing: border-box;
}

/* Custom scrollbar for scroll mode */
.rtw-table-wrapper::-webkit-scrollbar        { height: 4px; }
.rtw-table-wrapper::-webkit-scrollbar-track  { background: rgba(0,0,0,.05); border-radius: 2px; }
.rtw-table-wrapper::-webkit-scrollbar-thumb  { background: rgba(0,0,0,.2);  border-radius: 2px; }

/* Table --------------------------------------------------------------------- */
.rtw-table {
    width: 100%;
    /*
     * Do NOT set table-layout:fixed here.
     * Scroll mode overrides the table to width:max-content at the breakpoint
     * so it can overflow its wrapper. With table-layout:fixed + width:100%
     * the table would always compress to fit its container and never scroll.
     * Column widths from <colgroup> are respected by the browser's default
     * auto layout — fixed layout is not required for that to work.
     */
    border-collapse: collapse;
}

.rtw-table *,
.rtw-table *::before,
.rtw-table *::after {
    box-sizing: border-box;
}

/* Cells --------------------------------------------------------------------- */
.rtw-table th,
.rtw-table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    vertical-align: middle;
}

/* Default header ------------------------------------------------------------ */
.rtw-table thead th,
.rtw-table tr.rtw-row-header td {
    background-color: #f0f0f0;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border: 1px solid #ddd;
    white-space: nowrap;
}

/* Default body cells -------------------------------------------------------- */
.rtw-table tbody td {
    padding: 10px 16px;
    border: 1px solid #e4e4e4;
}

/* Cell inner wrapper */
.rtw-cell-inner {
    display: block;
}

/* Links inside body cells --------------------------------------------------- */
.rtw-table tbody td a {
    color: inherit;
    text-decoration: underline;
}

.rtw-table tbody td a:hover {
    opacity: .75;
}

/* Default footer ------------------------------------------------------------ */
.rtw-table tfoot td,
.rtw-table tr.rtw-row-footer td {
    background-color: #f0f0f0;
    font-weight: 600;
    padding: 12px 16px;
    border: 1px solid #ddd;
}

/* Empty placeholder --------------------------------------------------------- */
.rtw-empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 1.5em;
}

/* =============================================================================
   Sort indicators
   ============================================================================= */

/* Sortable headers get a pointer cursor and smooth hover */
thead th[data-rtw-sort-col] {
    cursor: pointer;
    user-select: none;
    transition: background-color .15s ease;
    white-space: nowrap;
}

thead th[data-rtw-sort-col]:hover {
    background-color: rgba(0, 0, 0, .06);
}

.rtw-sort-icon {
    display: inline-block;
    margin-left: 5px;
    font-size: 11px;
    opacity: .4;
    vertical-align: middle;
    line-height: 1;
    transition: opacity .15s ease, transform .15s ease;
}

thead th[data-rtw-sort-col]:hover .rtw-sort-icon {
    opacity: .7;
}

/* Active sorted column */
thead th[data-rtw-sort-dir] .rtw-sort-icon {
    opacity: 1;
}

/* =============================================================================
   Filter bar
   ============================================================================= */

.rtw-filter-bar {
    margin-bottom: 12px;
}

.rtw-filter-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 100%;
}

/* Search icon */
.rtw-filter-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    pointer-events: none;
    color: #999;
    line-height: 1;
    z-index: 1;
}

/* Input */
.rtw-filter-input {
    width: 100%;
    padding: 9px 32px 9px 34px; /* space for icon (left) and clear button (right) */
    font-size: inherit;
    font-family: inherit;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: inherit;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

/* Remove native clear button from search input in WebKit */
.rtw-filter-input::-webkit-search-cancel-button,
.rtw-filter-input::-webkit-search-decoration {
    -webkit-appearance: none;
}

.rtw-filter-input:focus {
    border-color: #666;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .07);
}

/* Clear button */
.rtw-filter-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    border-radius: 50%;
    transition: color .15s ease, background-color .15s ease, opacity .15s ease;
    opacity: 0;            /* shown/hidden via JS */
    pointer-events: none;
}

.rtw-filter-clear:hover {
    color: #333;
    background-color: rgba(0, 0, 0, .08);
}

/* No-results row ------------------------------------------------------------ */
.rtw-no-results-cell {
    text-align: center;
    padding: 20px 16px;
    color: #999;
    font-style: italic;
}

/* =============================================================================
   Stack mode — ::before pseudo-element setup
   (The actual @media block is injected inline, scoped to each widget instance.)
   ============================================================================= */
.rtw-table.rtw-stacked td::before {
    font-weight: 600;
    white-space: nowrap;
}

/* =============================================================================
   Elementor editor helpers
   ============================================================================= */
.elementor-editor-active .rtw-widget-wrapper {
    min-height: 60px;
}

/* Make filter non-interactive in the editor (it won't have JS running) */
.elementor-editor-active .rtw-filter-input {
    pointer-events: none;
}
