/* db-admin.css — DB Admin Panel styles */
.db-hdr-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* AI Table Access panel */
.ai-access-panel {
    background: #252526;
    border: 1px solid #3e3e3e;
    border-radius: 6px;
    margin-bottom: 1.2rem;
    overflow: hidden;
}
.ai-access-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: #2d2d2d;
    cursor: pointer;
    user-select: none;
}
.ai-access-hdr:hover { background: #333; }
.ai-access-title { font-weight: 600; font-size: 0.9rem; color: #d4d4d4; }
.ai-access-chevron { color: #888; font-size: 0.75rem; transition: transform 0.15s; }
.ai-access-panel.collapsed .ai-access-chevron { transform: rotate(-90deg); }
.ai-access-body { padding: 0.8rem 1rem; }
.ai-access-panel.collapsed .ai-access-body { display: none; }
.ai-access-hint { color: #888; font-size: 0.8rem; margin: 0 0 0.7rem; }

/* ── Schema Sanitizer panel ─────────────────────────────────── */
.schema-check-panel {
    background: #252526;
    border: 1px solid #3e3e3e;
    border-radius: 6px;
    margin-bottom: 1.2rem;
    overflow: hidden;
}
.schema-check-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: #2d2d2d;
    cursor: pointer;
    user-select: none;
}
.schema-check-hdr:hover { background: #333; }
.schema-check-title { font-weight: 600; font-size: 0.9rem; color: #d4d4d4; }
.schema-check-chevron { color: #888; font-size: 0.75rem; transition: transform 0.15s; }
.schema-check-panel.collapsed .schema-check-chevron { transform: rotate(-90deg); }
.schema-check-body { padding: 0.8rem 1rem; }
.schema-check-panel.collapsed .schema-check-body { display: none; }

.schema-stats-container {
    background: #1e1e1e;
    border: 1px solid #3e3e3e;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 15px;
}
.schema-stats-grid {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}
.schema-stat-box {
    text-align: center;
    flex: 1;
}
.schema-stat-box .stat-title {
    color: #9cdcfe;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.schema-stat-box .stat-values {
    display: flex;
    justify-content: center;
    gap: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}
.schema-stat-box .stat-good { color: #4ec9b0; }
.schema-stat-box .stat-ghost { color: #f44747; }

.schema-check-section-hdr {
    color: #f44747;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0.8rem 0 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.schema-check-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid #333;
}
.schema-check-label {
    flex: 1;
    font-size: 0.85rem;
    font-family: monospace;
    color: #ce9178;
}
.schema-check-drop {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    flex-shrink: 0;
}
.ai-table-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.ai-table-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #2a2a2a;
    border: 1px solid #3e3e3e;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}
.ai-table-name { color: #d4d4d4; }
.ai-table-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
}
.ai-table-badge.unlocked { background: #1a3a2a; color: #4ec9b0; }
.ai-table-badge.locked   { background: #3a1a1a; color: #888; }
.ai-table-toggle {
    background: none;
    border: 1px solid #555;
    color: #aaa;
    border-radius: 3px;
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    cursor: pointer;
}
.ai-table-toggle:hover { border-color: #888; color: #d4d4d4; }

.db-table-combo {
    position: relative;
    display: inline-block;
}
.db-table-input-wrap {
    position: relative;
    display: inline-block;
}
.db-table-search {
    background: #3c3c3c;
    color: #d4d4d4;
    border: 1px solid #555;
    padding: 0.4rem 1.6rem 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.875rem;
    width: 280px;
    outline: none;
    box-sizing: border-box;
    display: block;
}
.db-table-search:focus {
    border-color: #569cd6;
}
.db-table-clear {
    position: absolute;
    right: 2px;
    top: 0;
    width: 22px;
    height: 70%;
    background: none;
    border: none;
    color: #888;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: none;
    align-items: center;
    justify-content: center;
}
.db-table-clear:hover { color: #d4d4d4; }
.db-table-combo.has-value .db-table-clear { display: flex; }
.db-table-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 320px;
    overflow-y: auto;
    background: #2d2d2d;
    border: 1px solid #569cd6;
    border-radius: 0 0 4px 4px;
    z-index: 1000;
}
.db-table-item {
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
    color: #d4d4d4;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.db-table-item:hover {
    background: #094771;
    color: #fff;
}

.db-btn-new { display: none; }
.db-btn-new.visible { display: inline-block; }

.db-row-count {
    color: #858585;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
    min-height: 1em;
}

.db-pagination {
    display: none;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}
.db-pagination.visible { display: flex; }

.db-page-info {
    color: #858585;
    font-size: 0.85rem;
}

/* Slide-in edit/create panel */
.db-edit-panel {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: #252526;
    border-left: 1px solid #444;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.5);
}
.db-edit-panel.open { display: block; }

.db-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.db-panel-title {
    margin: 0;
    color: #d4d4d4;
    font-size: 1rem;
    font-weight: 600;
}

.db-panel-close {
    background: none;
    border: none;
    color: #858585;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 3px;
}
.db-panel-close:hover { color: #d4d4d4; }

.db-edit-form label {
    display: block;
    margin-bottom: 10px;
    color: #9cdcfe;
    font-size: 0.82rem;
}

.db-edit-form input[type="text"],
.db-edit-form textarea,
.db-edit-form select {
    width: 100%;
    box-sizing: border-box;
    background: #1e1e1e;
    color: #d4d4d4;
    border: 1px solid #444;
    padding: 4px 6px;
    border-radius: 3px;
    font-size: 0.85rem;
    margin-top: 3px;
}
.db-edit-form textarea { resize: vertical; }
.db-edit-form input[type="text"]:focus,
.db-edit-form textarea:focus,
.db-edit-form select:focus {
    outline: none;
    border-color: #569cd6;
}
.db-edit-form select option { background: #2d2d2d; }

.db-panel-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.db-btn-delete { display: none; }
.db-btn-delete.visible { display: inline-block; }

.db-panel-msg {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #858585;
    min-height: 1.2em;
}
.db-panel-msg.ok  { color: #4ec9b0; }
.db-panel-msg.err { color: #f44747; }

.db-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
}
.db-overlay.open { display: block; }

/* Small button for table action cells */
.btn-sm {
    padding: 3px 10px !important;
    font-size: 12px !important;
}

/* Tabulator dark-theme overrides scoped to db-table-grid */
#db-table-grid .tabulator {
    background: #1e1e1e;
    border: 1px solid #3c3c3c;
    border-radius: 4px;
}
#db-table-grid .tabulator-header {
    background: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
}
#db-table-grid .tabulator-col {
    background: #2d2d2d;
    border-right: 1px solid #3c3c3c;
}
#db-table-grid .tabulator-col-title {
    color: #9cdcfe;
    font-size: 0.82rem;
    font-weight: 600;
}
#db-table-grid .tabulator-col-sorter { color: #858585; }
#db-table-grid .tabulator-row {
    background: #1e1e1e;
    border-bottom: 1px solid #2a2a2a;
    color: #d4d4d4;
    font-size: 0.85rem;
}
#db-table-grid .tabulator-row.tabulator-row-even { background: #252526; }
#db-table-grid .tabulator-row:hover,
#db-table-grid .tabulator-row.tabulator-row-even:hover { background: #2a2d2e !important; }
#db-table-grid .tabulator-cell {
    border-right: 1px solid #2a2a2a;
    padding: 5px 8px;
    color: #d4d4d4;
}
#db-table-grid .tabulator-footer {
    background: #2d2d2d;
    border-top: 1px solid #3c3c3c;
    color: #d4d4d4;
}
#db-table-grid .tabulator-placeholder-contents { color: #666; }
