/* Modern Dark Mode DB Viewer Styles */

:root {
    --primary-color: #6366f1;
    --primary-hover: #5b5ef0;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border-color: #334155;
    --border-light: #475569;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.sidebar-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header h2 i {
    font-size: 1.75rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.nav-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-section h3 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.nav-list {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.tables-list {
    max-height: 300px;
    overflow-y: auto;
}

.table-link {
    font-size: 0.875rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1.5rem;
}

.database-selector {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.database-selector label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.db-select {
    width: 100%;
    padding: 0.5rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.db-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.db-select:hover {
    border-color: var(--primary-color);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--error-color);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-weight: 500;
    border: 1px solid transparent;
}

.logout-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--error-color);
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    background-color: var(--bg-primary);
    min-height: 100vh;
}

.main-content.full-width {
    margin-left: 0;
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-card {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
}

.login-form {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.login-btn {
    width: 100%;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.login-footer {
    text-align: center;
    color: var(--text-muted);
}

/* Dashboard */
.dashboard-header {
    margin-bottom: 2rem;
    animation: fadeInDown 0.6s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all var(--transition-fast);
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--text-secondary);
    font-weight: 500;
}

.tables-overview h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.table-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all var(--transition-fast);
    animation: scaleIn 0.6s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.table-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.table-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin: 0 auto 1.5rem;
}

.table-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.table-actions {
    margin-top: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.btn-edit {
    background-color: var(--warning-color);
    color: white;
}

.btn-edit:hover {
    background-color: #d97706;
    transform: scale(1.1);
}

.btn-delete {
    background-color: var(--error-color);
    color: white;
}

.btn-delete:hover {
    background-color: #dc2626;
    transform: scale(1.1);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Table View */
.table-view {
    animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.table-header {
    margin-bottom: 2rem;
}

.table-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-title h1 {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-count {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.table-actions {
    display: flex;
    gap: 1rem;
}

.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.table-container.large-dataset {
    /* Optimizations for large datasets */
    contain: layout style paint;
    will-change: scroll-position;
}

.table-container::-webkit-scrollbar {
    width: 12px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 2px solid var(--bg-secondary);
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

.table-info {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

.table-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stats-item i {
    color: var(--primary-color);
}

.stats-item strong {
    color: var(--text-primary);
}

.performance-note {
    color: var(--success-color);
    font-weight: 500;
}

.performance-note i {
    color: var(--success-color);
    animation: pulse 2s infinite;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    word-wrap: break-word;
}

.data-table th {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 200px;
    min-width: 80px;
}

.data-table th .column-type {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-top: 0.25rem;
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-fast);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 200px;
    min-width: 80px;
    white-space: normal;
    line-height: 1.4;
}

.data-table tr:hover {
    background-color: var(--bg-hover);
}

.actions-column {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    text-align: center;
}

/* Specific column width optimizations */
.data-table th:first-child,
.data-table td:first-child {
    /* ID column - usually narrow */
    width: 80px;
    min-width: 60px;
    max-width: 100px;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    /* Usually name/title column - medium width */
    width: 25%;
    min-width: 120px;
    max-width: 250px;
}

.data-table th:nth-child(3),
.data-table td:nth-child(3) {
    /* Content column - flexible width */
    width: auto;
    min-width: 150px;
    max-width: 300px;
}

/* Long text handling */
.data-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.data-table td:hover {
    overflow: visible;
    white-space: normal;
    z-index: 5;
    background-color: var(--bg-hover);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border-radius: var(--radius-sm);
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-form {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Delete Table Modal Styles */
.delete-modal {
    max-width: 600px;
    border: 2px solid var(--error-color);
}

.delete-modal .modal-header {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
    color: white;
}

.delete-modal .modal-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.warning-message {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.warning-icon {
    flex-shrink: 0;
}

.warning-icon i {
    font-size: 3rem;
    color: var(--error-color);
    animation: pulse 2s infinite;
}

.warning-text h3 {
    color: var(--error-color);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-align: center;
}

.warning-text p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.warning-text strong {
    color: var(--error-color);
    font-weight: 700;
}

.confirmation-steps {
    margin-bottom: 2rem;
}

.step {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.step h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step h4:before {
    content: attr(data-step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
}

.step:nth-child(1) h4:before {
    content: "1";
}

.step:nth-child(2) h4:before {
    content: "2";
}

.confirmation-input {
    margin-top: 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.confirmation-input:focus {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-validation {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    min-height: 1.2em;
}

.input-validation.valid {
    color: var(--success-color);
}

.input-validation.invalid {
    color: var(--error-color);
}

.delete-final-btn {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all var(--transition-fast);
    cursor: not-allowed;
    opacity: 0.5;
}

.delete-final-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.delete-final-btn.enabled {
    cursor: pointer;
    opacity: 1;
    animation: pulseRed 2s infinite;
}

.delete-final-btn.enabled:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

@keyframes pulseRed {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

/* Close modal when clicking outside */
.modal[style*="flex"] {
    animation: fadeIn 0.3s ease;
}

.delete-modal .modal-content {
    animation: slideUp 0.3s ease;
}

/* Query Interface */
.query-interface {
    max-width: 1200px;
    margin: 0 auto;
}

.query-header {
    margin-bottom: 2rem;
    text-align: center;
}

.query-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.query-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.query-form {
    margin-bottom: 2rem;
}

.query-textarea {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    resize: vertical;
    transition: all var(--transition-fast);
}

.query-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.query-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.query-result {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid;
}

.query-result.success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color);
}

.query-result.error {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--error-color);
}

.query-result h3 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-table-container {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.result-table td {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
}

.result-info {
    color: var(--text-secondary);
    font-style: italic;
}

.query-help {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.query-help h3 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-content {
    color: var(--text-secondary);
}

.help-section h4 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.help-section ul {
    list-style: none;
    padding-left: 1rem;
}

.help-section li {
    margin-bottom: 0.5rem;
}

.help-section code {
    background-color: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 2rem;
}

.flash-message {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.flash-message.error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

/* Notifications */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    z-index: 1001;
    animation: slideInRight 0.3s ease;
}

.notification.success {
    background-color: rgba(16, 185, 129, 0.9);
    color: white;
}

.notification.error {
    background-color: rgba(239, 68, 68, 0.9);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .table-title {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table-actions {
        flex-wrap: wrap;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tables-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .query-actions {
        flex-direction: column;
    }
    
    .dashboard-header h1 {
        font-size: 2rem;
    }
    
    .table-title h1 {
        font-size: 1.5rem;
    }
    
    /* Mobile table optimizations */
    .data-table th,
    .data-table td {
        padding: 0.5rem;
        font-size: 0.875rem;
        max-width: 150px;
    }
    
    .data-table th:first-child,
    .data-table td:first-child {
        width: 60px;
        min-width: 50px;
        max-width: 80px;
    }
    
    .data-table th:nth-child(2),
    .data-table td:nth-child(2) {
        width: 30%;
        min-width: 100px;
        max-width: 180px;
    }
    
    .actions-column {
        width: 80px;
        min-width: 80px;
        max-width: 80px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .data-table th,
    .data-table td {
        padding: 0.4rem;
        font-size: 0.8rem;
        max-width: 120px;
    }
    
    .data-table th:first-child,
    .data-table td:first-child {
        width: 50px;
        min-width: 40px;
        max-width: 60px;
    }
    
    .table-count {
        font-size: 0.875rem;
        padding: 0.2rem 0.5rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Loading Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    animation: spin 1s linear infinite;
}
