.basistables-admin{padding:16px}
/* Modern 2025 design tokens (scoped) */
.basistables-admin{--bt-bg:#f6f7f7;--bt-card-bg:#ffffff;--bt-border:#e2e4e7;--bt-text:#000;--bt-muted:#646970;--bt-primary:#2271b1;--bt-primary-contrast:#ffffff;--bt-accent:#6f42c1;--bt-focus:#9ecbff;--bt-shadow:0 8px 24px rgba(0,0,0,.08);--bt-radius:10px;--bt-radius-lg:14px;--bt-ease:cubic-bezier(.2,.8,.2,1)}
@media (prefers-color-scheme: dark){.basistables-admin{--bt-bg:#101417;--bt-card-bg:#11181C;--bt-border:#2b3036;--bt-text:#000;--bt-muted:#9aa0a6;--bt-primary:#58a6ff;--bt-primary-contrast:#0b0f12;--bt-accent:#b692f6;--bt-focus:#3b82f6;--bt-shadow:0 10px 30px rgba(0,0,0,.35)}}

/* Base typography & container polish */
.basistables-admin{color:var(--bt-text)}
.basistables-admin .description,.basistables-admin .howto{color:var(--bt-muted)}
/* Force toolbar to be bright */
.bt-toolbar{background:#fff}


/* Toolbar: modern surface */
.bt-toolbar{background:#fff;border:1px solid var(--bt-border);border-radius:var(--bt-radius);box-shadow:var(--bt-shadow);padding:10px 12px}
.bt-toolbar .button{border-radius:8px;border-color:var(--bt-border);transition:all .15s var(--bt-ease)}
/* Make secondary toolbar buttons subtle */
.bt-toolbar .button:not(#bt-add-data):not(#bt-add-column):not(.button-primary){background:#fff;border-color:var(--bt-border);color:var(--bt-text)}

.bt-toolbar .button:hover{transform:translateY(-1px);box-shadow:0 6px 16px rgba(0,0,0,.08)}
.bt-toolbar .button-primary{background:var(--bt-primary);border-color:transparent;color:var(--bt-primary-contrast)}
.bt-toolbar .button-primary:hover{filter:brightness(1.05)}
.bt-toolbar-search{display:inline-flex;align-items:center;gap:6px}

.bt-toolbar-search input[type="search"]{background:var(--bt-card-bg);border:1px solid var(--bt-border);border-radius:8px;padding:6px 10px;width:0;opacity:0;pointer-events:none;transition:width .18s var(--bt-ease), opacity .18s var(--bt-ease)}
/* Emphasize primary actions: Add Row / Add Column */
.bt-toolbar-search.open input[type="search"]{width:220px;opacity:1;pointer-events:auto}
.bt-toolbar .dashicons-search{cursor:pointer}

#bt-add-data.button, #bt-add-column.button{background:var(--bt-primary);color:var(--bt-primary-contrast);border:0;border-radius:999px;padding:6px 14px;font-weight:600;box-shadow:0 6px 16px rgba(34,113,177,.25);transition:transform .12s var(--bt-ease), box-shadow .12s var(--bt-ease)}
#bt-add-data.button:hover, #bt-add-column.button:hover{transform:translateY(-1px);box-shadow:0 10px 24px rgba(34,113,177,.28)}
#bt-add-data .dashicons, #bt-add-column .dashicons{margin-right:6px}
/* Save all is important too */



/* Grid table: card look */
.basistables-rows-grid{background:var(--bt-card-bg);border:1px solid var(--bt-border);border-radius:var(--bt-radius-lg);box-shadow:var(--bt-shadow);overflow:hidden}
.basistables-rows-grid thead th{background:linear-gradient(180deg,#fafafa,transparent);border-bottom:1px solid var(--bt-border)}
.basistables-rows-grid td{background:var(--bt-card-bg)}
/* Unified button system within plugin admin */
.basistables-admin .button{background:#fff;color:var(--bt-text);border:1px solid var(--bt-border);border-radius:8px;padding:6px 12px;line-height:1.4;box-shadow:none}
.basistables-admin .button:hover{transform:translateY(-1px);box-shadow:0 6px 16px rgba(0,0,0,.06)}
.basistables-admin .button:active{transform:translateY(0)}
.basistables-admin .button.button-primary{background:var(--bt-primary);color:var(--bt-primary-contrast);border:0}
.basistables-admin .button.button-small{padding:4px 10px;font-size:12px}
.basistables-admin .button-link-delete{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border:1px solid #e6b8b8;background:#fff;color:#b32d2e;border-radius:8px;text-decoration:none}
.basistables-admin .button-link-delete:hover{background:#fff5f5;border-color:#e0aaaa}

.basistables-rows-grid tbody tr:hover td{background:rgba(34,113,177,.06)}

/* Sticky header for better context on long tables */
.basistables-rows-grid thead th{position:sticky;top:0;z-index:2}
.basistables-rows-grid thead th.bt-col-width{z-index:3}
/* Zebra striping for better readability */
.basistables-rows-grid tbody tr:nth-child(odd) > td{background:#fbfbfc}
.basistables-rows-grid tbody tr:nth-child(even) > td{background:#f6f7f8}
.basistables-rows-grid tbody tr:hover > td{background:#eef6fd}


/* Row/Col placeholders already defined; enhance border radius matching */
.basistables-rows-grid thead .bt-col-placeholder{border-radius:6px}
.basistables-rows-grid tbody .bt-row-placeholder td:first-child{border-top-left-radius:8px;border-bottom-left-radius:8px}
.basistables-rows-grid tbody .bt-row-placeholder td:last-child{border-top-right-radius:8px;border-bottom-right-radius:8px}

/* Buttons & inputs inside admin scope */
.basistables-admin .button{border-radius:8px}
.basistables-admin .regular-text,.basistables-admin select{border-radius:8px;border:1px solid var(--bt-border)}

/* Focus styles for accessibility */
.basistables-admin :focus-visible{outline:2px solid var(--bt-focus);outline-offset:1px;border-radius:6px}

/* Modal refinements */
.bt-modal{background:var(--bt-card-bg);border:1px solid var(--bt-border);box-shadow:var(--bt-shadow)}
.bt-modal-actions .button-primary{background:var(--bt-primary);color:var(--bt-primary-contrast);border:0}

/* Context menu polish */
.bt-context-menu{border-color:var(--bt-border);box-shadow:var(--bt-shadow)}
.bt-context-menu .bt-ctx-item{transition:background-color .12s var(--bt-ease)}

/* Toast polish */
.bt-toast{background:#111827;color:#f9fafb;border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.22)}



.basistables-columns-table .bt-drag-handle{cursor:move}

.bt-toast{position:fixed;right:16px;bottom:16px;background:#1e1e1e;color:#fff;padding:10px 14px;border-radius:4px;opacity:0;transform:translateY(10px);transition:all .2s ease;z-index:100000}
/* Ensure header text is dark and readable */
.basistables-rows-grid thead th, .basistables-rows-grid thead th .bt-th-label{color:#1d2327}

/* Sort indicator (subtle, animated) */
.basistables-rows-grid thead th .bt-sort-indicator{display:none;width:10px;height:10px;margin-left:6px;position:relative;top:-1px}
.basistables-rows-grid thead th.is-sorted .bt-sort-indicator{display:inline-block}
.basistables-rows-grid thead th.is-sorted .bt-sort-indicator::before{content:'';display:block;width:8px;height:8px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;opacity:.85;transform:rotate(45deg);transition:transform .18s var(--bt-ease),opacity .18s var(--bt-ease)}
.basistables-rows-grid thead th.is-sorted-asc .bt-sort-indicator::before{transform:rotate(-135deg)}
.basistables-rows-grid thead th.is-sorted-desc .bt-sort-indicator::before{transform:rotate(45deg)}

.bt-toast.show{opacity:1;transform:translateY(0)}

/* Saving indicator (bottom-right) */
.bt-saving-indicator{position:fixed;right:16px;bottom:16px;background:rgba(34,113,177,.95);color:#fff;padding:8px 10px;border-radius:4px;box-shadow:0 2px 10px rgba(0,0,0,.12);display:none;align-items:center;gap:8px;z-index:100001;font:12px/1.4 -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial}
/* Header label emphasis */
.basistables-rows-grid thead th .bt-th-label{font-weight:600;color:var(--bt-text)}

.bt-saving-indicator .bt-spin{width:14px;height:14px;border:2px solid rgba(255,255,255,.8);border-top-color:transparent;border-radius:50%;animation:btspin .8s linear infinite}
.bt-saving-indicator.show{display:inline-flex}
@keyframes btspin{to{transform:rotate(360deg)}}

/* Context menu for cells */
.bt-context-menu{position:absolute;z-index:10010;background:#fff;border:1px solid #c3c4c7;box-shadow:0 4px 20px rgba(0,0,0,.12);border-radius:4px;min-width:180px;overflow:hidden}
.bt-context-menu .bt-ctx-item{display:block;width:100%;text-align:left;padding:8px 12px;background:#fff;border:0;color:#1d2327;cursor:pointer}
.bt-context-menu .bt-ctx-item:hover{background:#f0f0f1}
.bt-context-menu .bt-ctx-item.danger{color:#b32d2e}
.bt-context-menu hr{border:0;border-top:1px solid #e2e4e7;margin:4px 0}

.basistables-rows-grid thead th.bt-col-width{position:relative}
.bt-width-tip{position:absolute;right:6px;top:4px;background:#2271b1;color:#fff;border-radius:10px;padding:1px 6px;font-size:11px;line-height:18px;opacity:.001;transform:translateY(-2px);transition:opacity .15s ease, transform .15s ease;pointer-events:none}
.bt-width-tip.show{opacity:1;transform:translateY(0)}

.basistables-rows-sortable tr.bt-insert-highlight td,
.basistables-columns-sortable tr.bt-insert-highlight td{box-shadow:inset 0 0 0 9999px rgba(255,235,59,.35)}


/* Header inner with gear */
.basistables-rows-grid thead th .bt-th-inner{display:flex;align-items:center;gap:6px;justify-content:space-between}
.basistables-rows-grid thead th .bt-col-gear{opacity:.6;color:#1d2327}
.basistables-rows-grid thead th .bt-col-gear:hover{opacity:1}

/* Grid inputs */
.basistables-rows-grid td input.bt-cell-input{width:100%;box-sizing:border-box;min-width:0}

/* Modal */
.bt-modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.25);backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;z-index:100000}
.bt-modal{background:#fff;border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.2);padding:16px;min-width:320px;max-width:90vw}
.bt-modal-actions{display:flex;gap:8px;justify-content:flex-end}


/* Toolbar above grid */
.bt-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:8px 0}
.bt-compact-toggle{display:none!important}

.bt-toolbar-left,.bt-toolbar-right{display:flex;align-items:center;gap:8px}
/* collapsed by default; see .bt-toolbar-search.open for width */
.bt-compact-toggle input{vertical-align:middle}
.bt-sort-manually{opacity:.7}
.bt-sort-manually:hover{opacity:1}

/* Compact grid mode */
.basistables-rows-grid.bt-compact td,
.basistables-rows-grid.bt-compact th{padding-top:4px;padding-bottom:4px;line-height:1.2}
.basistables-rows-grid.bt-compact input.bt-cell-input{padding:2px 6px}


/* Toolbar polish */
.bt-toolbar-left .button{margin-right:6px}
.bt-toolbar-left .button:last-child{margin-right:0}
.bt-toolbar .button .dashicons{vertical-align:text-bottom;margin-right:4px}

/* Column visibility dropdown */
.bt-colvis-menu{box-shadow:0 8px 24px rgba(0,0,0,.18);border:1px solid #dfe3e8}
/* Column drag handle + sortable affordance */
.basistables-rows-grid thead .bt-col-drag{cursor:move; opacity:.6}
/* Keep header as positioning context for DnD helper */
.basistables-rows-grid thead{position:relative}

.basistables-rows-grid thead .bt-col-drag:hover{opacity:1}
.basistables-rows-grid thead .bt-th-label{cursor:pointer}



/* Sortable header placeholder for columns */
.basistables-rows-grid thead .bt-col-placeholder{background:#fff5c4;border:2px dashed #c3c4c7;visibility:visible}
/* Sortable row placeholder for grid rows */
.basistables-rows-grid tbody .bt-row-placeholder td{background:#fff5c4;border-top:2px dashed #c3c4c7;border-bottom:2px dashed #c3c4c7}
.basistables-rows-grid tbody .ui-sortable-helper td{background:#f6f7f7}

.basistables-rows-grid thead .bt-col-placeholder .bt-th-inner{visibility:hidden}
/* Helper visual while dragging */
.basistables-rows-grid thead .ui-sortable-helper{background:#f6f7f7;opacity:.95}


/* Hide Debug mode toggle */
.bt-debug-toggle{display:none!important}
