/* Base Styles - Professional Light Theme */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary-color: #6b7280;
    --success-color: #059669;
    --success-light: #d1fae5;
    --warning-color: #d97706;
    --warning-light: #fef3c7;
    --danger-color: #dc2626;
    --danger-light: #fee2e2;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --bg-hover: #f1f5f9;
    --bg-input: #f9fafb;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #f1f5f9;
    --text-sidebar-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-dark: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Professional Dark Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-right: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header i {
    font-size: 1.5rem;
    color: #818cf8;
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-sidebar);
    letter-spacing: -0.025em;
}

.add-db-btn {
    margin: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.add-db-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
}

.databases-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.databases-list::-webkit-scrollbar {
    width: 6px;
}

.databases-list::-webkit-scrollbar-track {
    background: transparent;
}

.databases-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.db-item {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    color: var(--text-sidebar);
}

.db-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.db-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.db-item .db-icon {
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a5b4fc;
}

.db-item.active .db-icon {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.db-item .db-details {
    flex: 1;
    min-width: 0;
}

.db-item .db-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-sidebar);
}

.db-item .db-host {
    font-size: 0.75rem;
    color: var(--text-sidebar-muted);
}

.db-item.active .db-host {
    color: rgba(255, 255, 255, 0.7);
}

.db-item .db-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success-color);
    box-shadow: 0 0 8px rgba(5, 150, 105, 0.6);
}

.db-item .remove-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-sidebar-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: opacity 0.2s;
}

.db-item:hover .remove-btn {
    opacity: 1;
}

.db-item .remove-btn:hover {
    color: var(--danger-color);
}

/* Unread lead count badge */
.unread-badge {
    background: linear-gradient(135deg, var(--danger-color), #ef4444);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4);
    flex-shrink: 0;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.db-item.active .unread-badge {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-sidebar-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--warning-color);
}

.status-dot.connected {
    background-color: var(--success-color);
}

.status-dot.disconnected {
    background-color: var(--danger-color);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg-main);
}

.main-header {
    padding: 1rem 2rem;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.db-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 0.625rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    color: var(--text-secondary);
}

.notification-bell:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.notification-bell i {
    font-size: 1.25rem;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: linear-gradient(135deg, var(--danger-color), #ef4444);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.4);
}

/* Notifications Panel */
.notifications-panel {
    position: absolute;
    top: 60px;
    right: 1rem;
    width: 380px;
    max-height: 500px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
    flex-direction: column;
}

.notifications-panel.show {
    display: flex;
}

.notifications-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notifications-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.notification-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    transition: background-color 0.2s;
}

.notification-item:hover {
    background-color: var(--bg-hover);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.add {
    background-color: var(--success-light);
    color: var(--success-color);
}

.notification-icon.delete {
    background-color: var(--danger-light);
    color: var(--danger-color);
}

.notification-icon.new {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.notification-content {
    flex: 1;
}

.notification-content .title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.notification-content .message {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.notification-content .time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.no-notifications {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 2rem;
    padding-top: 90px; /* Account for fixed header */
    overflow-y: auto;
    max-width: 100%;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    text-align: center;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 3rem;
}

.welcome-screen i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.welcome-screen h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.welcome-screen p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Tables Grid */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.table-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.table-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.table-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.table-card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #e0e7ff 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.table-card-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.table-card-info {
    display: flex;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.table-card-info span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Table Data View */
.table-data-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.table-data-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.row-count {
    background-color: var(--primary-light);
    color: var(--primary-color);
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.table-wrapper {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--bg-hover);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 5;
}

.data-table tbody tr:hover {
    background-color: var(--bg-hover);
}

.data-table td {
    font-size: 0.875rem;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}



/* Status Select Dropdown */
.status-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
    max-width: 120px;
}

.status-select:hover {
    border-color: var(--primary-color);
}

.status-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.status-select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Action Buttons Container */
.action-btns {
    display: flex;
    gap: 0.375rem;
    align-items: center;
}

/* Copy Button */
.copy-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 500;
}

.copy-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn.copied {
    background-color: var(--success-color);
}

/* Mark as Read Button */
.mark-read-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
}

.mark-read-btn:hover {
    background-color: #047857;
    transform: translateY(-1px);
}

.mark-read-btn:active {
    transform: translateY(0);
}

/* Delete Button */
.delete-btn {
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
}

.delete-btn:hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
}

.delete-btn:active {
    transform: translateY(0);
}

/* Unread Row Highlighting */
.unread-row {
    background-color: var(--warning-light) !important;
    border-left: 3px solid var(--warning-color);
}

.unread-row:hover {
    background-color: #fef9c3 !important;
}

/* ===================== SPAM DETECTION STYLES ===================== */

/* Spam Row - Red strikethrough highlighting */
.spam-row {
    background-color: #fee2e2 !important;
    border-left: 4px solid #dc2626 !important;
    opacity: 0.75;
    position: relative;
}

.spam-row:hover {
    background-color: #fecaca !important;
    opacity: 1;
}

.spam-row td {
    color: #991b1b;
    text-decoration: line-through;
    text-decoration-color: rgba(220, 38, 38, 0.4);
}

.spam-row td:first-child,
.spam-row td:nth-child(2),
.spam-row td:nth-child(3) {
    text-decoration: none;
}

/* Override unread for spam rows */
.spam-row.unread-row {
    background-color: #fee2e2 !important;
    border-left: 4px solid #dc2626 !important;
}

/* Spam Badge */
.spam-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: spamPulse 2s ease-in-out infinite;
    cursor: help;
    margin-left: 6px;
    white-space: nowrap;
}

.spam-badge i {
    font-size: 0.6rem;
}

.spam-badge-sm {
    display: inline-flex;
    align-items: center;
    color: #dc2626;
    font-size: 0.85rem;
    cursor: help;
    margin-right: 4px;
}

@keyframes spamPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Spam Counter in row count area */
.spam-counter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: #fee2e2;
    color: #dc2626;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid #fecaca;
}

.spam-counter i {
    font-size: 0.7rem;
}

/* Spam Clean Button */
.btn-spam-clean {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white !important;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.btn-spam-clean:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.btn-spam-clean i {
    font-size: 0.65rem;
}

/* ===================== END SPAM STYLES ===================== */

.date-cell {
    white-space: nowrap;
    color: var(--text-secondary);
}

/* Database Badge */
.db-badge {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Combined Data View */
.combined-data-view {
    flex: 1;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.pagination button {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--bg-hover);
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination .page-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-icon {
    background-color: transparent;
    color: var(--text-secondary);
    padding: 0.625rem;
    border-radius: var(--radius);
}

.btn-icon:hover {
    background-color: var(--bg-hover);
    color: var(--primary-color);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.modal-content-lg {
    max-width: 600px;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Database Step Forms */
.db-step {
    padding: 1.5rem;
}

.step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.connection-success {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success-color);
    font-weight: 500;
    font-size: 0.875rem;
}

.connection-success i {
    font-size: 1rem;
}

/* Table Selection Styles */
.table-selection-container {
    margin-bottom: 1.5rem;
}

.table-selection-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.table-selection-note {
    font-size: 0.813rem;
    color: var(--text-muted);
    margin: 0;
}

.table-selection-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.table-selection-actions .btn-sm {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

.selected-count {
    margin-left: auto;
    font-size: 0.813rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.table-selection-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-input);
}

.table-selection-list::-webkit-scrollbar {
    width: 6px;
}

.table-selection-list::-webkit-scrollbar-track {
    background: transparent;
}

.table-selection-list::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 3px;
}

.table-selection-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.15s ease;
}

.table-selection-item:last-child {
    border-bottom: none;
}

.table-selection-item:hover {
    background: var(--bg-hover);
}

.table-selection-item.selected {
    background: var(--primary-light);
}

.table-selection-item input[type="checkbox"] {
    display: none;
}

.table-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-dark);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.table-checkbox i {
    font-size: 0.625rem;
    color: white;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.table-selection-item.selected .table-checkbox {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.table-selection-item.selected .table-checkbox i {
    opacity: 1;
}

.table-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.table-name i {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.no-tables {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Session Section Styles (Full Page View) */
.session-section {
    padding: 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.section-header h3 i {
    color: var(--primary-color);
}

.session-section-content {
    padding: 0;
}

.session-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.session-stat-card {
    background: linear-gradient(135deg, var(--primary-light) 0%, #f0f4ff 100%);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.session-stat-card.large {
    padding: 1.5rem;
}

.session-stat-card.large .stat-value {
    font-size: 2rem;
}

.session-action-card {
    background: linear-gradient(135deg, var(--danger-light) 0%, #fff5f5 100%);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.session-action-card .btn-danger {
    padding: 0.75rem 1.5rem;
}

.action-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background-color: var(--primary-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.stat-icon.active {
    background-color: var(--success-color);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Sessions Table */
.sessions-table-container {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.sessions-table-container h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 1rem 1.25rem;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-hover);
}

.sessions-table-container h4 i {
    color: var(--primary-color);
}

.sessions-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
}

.sessions-table {
    width: 100%;
    border-collapse: collapse;
}

.sessions-table th {
    background-color: var(--bg-input);
    padding: 0.875rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sessions-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.sessions-table tr.row-active {
    background-color: var(--success-light);
}

.sessions-table tr.row-inactive {
    background-color: var(--bg-card);
}

.sessions-table tr:hover {
    background-color: var(--bg-hover);
}

.session-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.session-status-badge.status-active {
    background-color: var(--success-light);
    color: var(--success-color);
}

.session-status-badge.status-inactive {
    background-color: var(--bg-hover);
    color: var(--text-muted);
}

.sessions-table code {
    background-color: var(--bg-input);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-family: 'Consolas', 'Monaco', monospace;
}

.no-sessions {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

@media (max-width: 992px) {
    .session-stats-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .session-action-card {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .session-stats-row {
        grid-template-columns: 1fr;
    }
    
    .session-action-card {
        grid-column: span 1;
    }
    
    .sessions-table-wrapper {
        overflow-x: auto;
    }
    
    .sessions-table {
        min-width: 600px;
    }
}

.loading-sessions, .no-sessions {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.loading-sessions i {
    margin-right: 0.5rem;
}

/* Session Badge Styles */
.session-badge-wrapper,
.session-icon-wrapper {
    position: relative;
    display: inline-block;
}

.session-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: linear-gradient(135deg, var(--success-color), #10b981);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.4);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(5, 150, 105, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 3px 8px rgba(5, 150, 105, 0.5);
    }
}

/* Duration Badge Styles */
.duration-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--bg-hover);
    color: var(--text-secondary);
}

.duration-badge.duration-active {
    background: linear-gradient(135deg, #dbeafe, #e0f2fe);
    color: #1e40af;
    animation: duration-pulse 3s infinite;
}

@keyframes duration-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.duration-badge::before {
    content: '\f017';
    font-family: 'Font Awesome 6 Free';
    font-weight: 400;
    font-size: 0.625rem;
}

/* Known Devices Styles */
.devices-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.device-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.device-icon {
    font-size: 1.25rem;
    color: var(--primary-color);
    width: 24px;
    text-align: center;
}

.device-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.device-details {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.login-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #4338ca;
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.trust-badge.trusted {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #15803d;
}

.trust-badge.trusted:hover {
    background: linear-gradient(135deg, #bbf7d0, #86efac);
}

.trust-badge.untrusted {
    background: linear-gradient(135deg, #fef9c3, #fef08a);
    color: #a16207;
}

.trust-badge.untrusted:hover {
    background: linear-gradient(135deg, #fef08a, #fde047);
}

/* Delete Confirmation Modal Styles */
.delete-modal-content {
    max-width: 420px;
}

.delete-modal-header {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
    gap: 0.75rem;
    position: relative;
}

.delete-modal-header .close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.delete-icon-wrapper {
    width: 60px;
    height: 60px;
    background-color: var(--danger-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.delete-icon-wrapper i {
    font-size: 1.75rem;
    color: var(--danger-color);
}

.delete-modal-body {
    padding: 0 1.5rem 1rem;
    text-align: center;
}

.delete-warning {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.record-preview {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: left;
}

.record-preview .record-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.record-preview .record-detail:last-child {
    border-bottom: none;
}

.record-preview .record-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 80px;
}

.record-preview .record-label i {
    color: var(--primary-color);
    width: 14px;
}

.record-preview .record-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.delete-note {
    font-size: 0.8125rem;
    color: var(--warning-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.delete-modal-body .form-group {
    text-align: left;
}

.delete-modal-actions {
    padding: 1rem 1.5rem 1.5rem;
    justify-content: center;
    gap: 1rem;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border: none;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Form */
#addDbForm {
    /* Padding now handled by .db-step */
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
    min-width: 300px;
    max-width: 450px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--success-color);
    background-color: var(--success-light);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
    background-color: var(--danger-light);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
    background-color: var(--warning-light);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
    background-color: var(--primary-light);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast.info .toast-icon {
    color: var(--primary-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.125rem;
    color: var(--text-primary);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.loading i {
    font-size: 2rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-sidebar-muted);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .main-header {
        padding: 0.75rem 1rem;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
    }
    
    .main-header h2 {
        font-size: 1rem;
    }
    
    .db-info {
        display: none;
    }
    
    .header-left {
        flex: 1;
        min-width: 0;
    }
    
    .header-right {
        gap: 0.5rem;
    }
    
    /* Mobile menu button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--primary-color);
        color: white;
        border: none;
        border-radius: 8px;
        width: 40px;
        height: 40px;
        cursor: pointer;
        margin-right: 0.5rem;
    }
    
    .sidebar-header {
        padding: 1rem;
    }
    
    .sidebar-header h1 {
        font-size: 1.125rem;
    }
    
    .add-db-btn {
        margin: 0.75rem;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .databases-list {
        max-height: calc(100vh - 200px);
    }
    
    .db-item {
        padding: 0.75rem 0.875rem;
    }
    
    .db-item .db-name {
        font-size: 0.875rem;
    }
    
    .db-item .db-host {
        font-size: 0.7rem;
    }
    
    .content-area {
        padding: 0.75rem;
        padding-top: 70px; /* Account for fixed header on mobile */
    }
    
    .tables-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .table-card {
        padding: 1rem;
    }
    
    .welcome-screen {
        padding: 1rem;
        min-height: 300px;
    }
    
    .welcome-screen i {
        font-size: 2.5rem;
    }
    
    .welcome-screen h2 {
        font-size: 1.25rem;
    }
    
    /* Table improvements for mobile */
    .table-data-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .table-data-header h3 {
        font-size: 1rem;
        flex: 1 1 100%;
    }
    
    .row-count {
        font-size: 0.75rem;
    }
    
    .table-wrapper {
        border-radius: 8px;
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
        min-width: 80px;
    }
    
    .data-table th {
        font-size: 0.7rem;
        white-space: nowrap;
    }
    
    .status-select {
        min-width: 120px;
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }
    
    .copy-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .delete-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .db-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Modal improvements */
    .modal-content {
        max-width: 95%;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h2 {
        font-size: 1rem;
    }
    
    #addDbForm {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-group input {
        font-size: 0.875rem;
    }
    
    /* Notifications panel */
    .notifications-panel {
        width: calc(100vw - 2rem);
        right: 1rem;
        left: 1rem;
        max-height: 400px;
    }
    
    .notification-item {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .notification-icon {
        width: 32px;
        height: 32px;
    }
    
    /* Toast notifications */
    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
        font-size: 0.75rem;
    }
    
    .pagination button {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
    
    .page-info {
        flex: 1 1 100%;
        text-align: center;
        margin-top: 0.25rem;
    }
    
    /* Buttons */
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .btn-icon {
        padding: 0.5rem;
        width: 36px;
        height: 36px;
    }
    
    .btn-sm {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
    
    /* Hide some elements on very small screens */
    @media (max-width: 480px) {
        .date-cell {
            max-width: 120px;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .notification-content .time {
            font-size: 0.7rem;
        }
        
        .table-card-info {
            flex-direction: column;
            gap: 0.25rem;
        }
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }
}
