/* ===== RLS DATA TAB - DATABASE STYLE ===== */
.rls-database-container {
    display: flex;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
    min-height: 500px;
}

/* Database Sidebar */
.rls-db-sidebar {
    width: 220px;
    background: #161b22;
    border-right: 1px solid #30363d;
    flex-shrink: 0;
}

.rls-db-sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid #30363d;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8b949e;
    font-weight: 600;
}

.rls-db-sidebar-header svg {
    width: 14px;
    height: 14px;
    stroke: #8b949e;
}

.rls-db-schema {
    padding: 8px 0;
}

.rls-db-schema-name {
    padding: 6px 16px;
    font-size: 12px;
    color: #8b949e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rls-db-schema-name svg {
    width: 12px;
    height: 12px;
}

.rls-db-tables {
    padding-left: 8px;
}

.rls-db-table-item {
    padding: 8px 16px;
    font-size: 13px;
    color: #c9d1d9;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 2px solid transparent;
    transition: all 0.15s;
    font-family: 'Space Mono', monospace;
}

.rls-db-table-item:hover {
    background: #21262d;
    color: #58a6ff;
}

.rls-db-table-item.active {
    background: #1f6feb20;
    border-left-color: #58a6ff;
    color: #58a6ff;
}

.rls-db-table-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rls-db-table-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.rls-db-table-count {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 6px;
    background: #30363d;
    border-radius: 10px;
    color: #8b949e;
    font-family: 'Space Mono', monospace;
}

/* Main Content Area */
.rls-db-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Query Bar / Toolbar */
.rls-db-toolbar {
    padding: 10px 16px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    display: flex;
    align-items: center;
    gap: 12px;
}

.rls-db-query-display {
    flex: 1;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: #8b949e;
    background: #0d1117;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #30363d;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rls-db-query-display .keyword {
    color: #ff7b72;
}

.rls-db-query-display .table-name {
    color: #79c0ff;
}

.rls-db-row-count {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #8b949e;
    padding: 6px 10px;
    background: #21262d;
    border-radius: 4px;
    white-space: nowrap;
}

/* User Session Bar */
.rls-db-session {
    padding: 8px 16px;
    background: #0d1117;
    border-bottom: 1px solid #30363d;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}

.rls-db-session-label {
    color: #8b949e;
}

.rls-db-session-user {
    font-family: 'Space Mono', monospace;
    color: #7ee787;
}

.rls-db-session-role {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.rls-db-session-role.admin {
    background: #f8514920;
    color: #f85149;
    border: 1px solid #f8514940;
}

.rls-db-session-role.customer {
    background: #58a6ff20;
    color: #58a6ff;
    border: 1px solid #58a6ff40;
}

.rls-db-session-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.rls-db-session-actions .btn-small {
    font-size: 11px;
    padding: 4px 10px;
}

/* No Session State */
.rls-db-no-session {
    padding: 12px 16px;
    background: #21262d;
    border-bottom: 1px solid #30363d;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.rls-db-no-session-icon {
    width: 28px;
    height: 28px;
    background: #30363d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rls-db-no-session-icon svg {
    width: 14px;
    height: 14px;
    stroke: #8b949e;
}

.rls-db-no-session-text {
    color: #8b949e;
}

.rls-db-no-session-text strong {
    color: #c9d1d9;
}

/* Results Table */
.rls-db-results {
    flex: 1;
    overflow: auto;
}

.rls-db-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: 'Space Mono', monospace;
}

.rls-db-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.rls-db-table th {
    background: #161b22;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #8b949e;
    border-bottom: 1px solid #30363d;
    white-space: nowrap;
    position: relative;
}

.rls-db-table th:first-child {
    width: 50px;
    text-align: center;
    color: #484f58;
}

.rls-db-table th .col-type {
    font-size: 9px;
    color: #6e7681;
    font-weight: 400;
    display: block;
    margin-top: 2px;
}

.rls-db-table td {
    padding: 8px 14px;
    border-bottom: 1px solid #21262d;
    color: #c9d1d9;
    vertical-align: top;
}

.rls-db-table td:first-child {
    text-align: center;
    color: #484f58;
    background: #0d1117;
    border-right: 1px solid #21262d;
    font-size: 11px;
}

.rls-db-table tr:hover td {
    background: #161b22;
}

.rls-db-table tr:hover td:first-child {
    background: #161b22;
}

/* Data Type Styling */
.rls-db-null {
    color: #6e7681;
    font-style: italic;
}

.rls-db-string {
    color: #a5d6ff;
}

.rls-db-number {
    color: #79c0ff;
}

.rls-db-date {
    color: #d2a8ff;
}

.rls-db-boolean {
    color: #ff7b72;
}

.rls-db-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.rls-db-badge.completed {
    background: #238636;
    color: #ffffff;
}

.rls-db-badge.pending {
    background: #9e6a03;
    color: #ffffff;
}

.rls-db-badge.admin {
    background: #f85149;
    color: #ffffff;
}

.rls-db-badge.customer {
    background: #58a6ff;
    color: #0d1117;
}

/* Empty State */
.rls-db-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #8b949e;
    text-align: center;
}

.rls-db-empty-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.rls-db-empty-icon svg {
    width: 48px;
    height: 48px;
    stroke: #484f58;
}

.rls-db-empty-title {
    font-size: 14px;
    color: #c9d1d9;
    margin-bottom: 4px;
}

.rls-db-empty-text {
    font-size: 12px;
}

/* Policy Warning */
.rls-db-policy-warning {
    padding: 10px 16px;
    background: rgba(210, 153, 34, 0.1);
    border-top: 1px solid rgba(210, 153, 34, 0.3);
    font-size: 12px;
    color: #d29922;
    font-family: 'Space Mono', monospace;
}

.rls-db-policy-warning.hidden {
    display: none;
}

.rls-db-policy-warning-title {
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rls-db-policy-warning-title svg {
    width: 14px;
    height: 14px;
    stroke: #d29922;
}

.rls-db-policy-warning-content {
    color: #e3b341;
}

.rls-db-policy-warning .policy-keyword {
    color: #ff7b72;
}

.rls-db-policy-warning .policy-value {
    color: #7ee787;
}

.rls-db-policy-warning .policy-function {
    color: #d2a8ff;
}

/* Status Bar */
.rls-db-statusbar {
    padding: 6px 16px;
    background: #161b22;
    border-top: 1px solid #30363d;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 11px;
    color: #8b949e;
    font-family: 'Space Mono', monospace;
}

.rls-db-statusbar-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rls-db-statusbar-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #238636;
}

.rls-db-statusbar-dot.disconnected {
    background: #f85149;
}

/* Hide legacy RLS elements */
.rls-current-user,
.rls-no-user,
.rls-sub-tabs,
.rls-filter-info,
.rls-panel,
.rls-table-container {
    display: none !important;
}

/* Legacy compatibility - hidden */
.rls-current-user-icon,
.rls-current-user-info {
    display: none;
}

.rls-current-user-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.rls-current-user-email {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}

.rls-current-user-role {
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
}

.rls-no-user {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
}

.rls-no-user-icon {
    font-size: 32px;
    opacity: 0.5;
}

.rls-no-user-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rls-no-user-text strong {
    color: var(--text-dim);
    font-size: 14px;
}

.rls-no-user-text span {
    color: var(--text-muted);
    font-size: 13px;
}

.rls-sub-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.rls-sub-tab {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rls-sub-tab:hover {
    border-color: var(--accent);
    color: var(--text);
}

.rls-sub-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
}

.rls-tab-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent);
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-text);
    display: none;
    align-items: center;
    justify-content: center;
}

.rls-sub-tab.active .rls-tab-badge {
    background: var(--bg-dark);
    color: var(--accent);
}

.rls-panel {
    display: none;
}

.rls-panel.active {
    display: block;
}

.rls-filter-info {
    margin-bottom: 12px;
}

.rls-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.rls-filter-badge.admin {
    background: rgba(255, 107, 107, 0.15);
    color: var(--error);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.rls-filter-badge.customer {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.rls-table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.rls-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.rls-table th {
    background: var(--bg-input);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.rls-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.rls-table tr:last-child td {
    border-bottom: none;
}

.rls-table tr:hover td {
    background: var(--bg-hover);
}

.rls-table .rls-empty-row td {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 32px 16px;
}

.rls-table .rls-empty-row:hover td {
    background: transparent;
}

.rls-order-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.rls-order-status.completed {
    background: rgba(0, 212, 170, 0.15);
    color: var(--accent);
}

.rls-order-status.pending {
    background: var(--warning-bg);
    color: var(--warning);
}
