/* Marmelos QueryFence - Premium Enterprise SaaS Theme */

:root {
    --sidebar-width: 260px;
    --topnav-height: 60px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --transition-speed: 0.3s;
}

[data-bs-theme="dark"] {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a2e;
    --bg-card: #16162a;
    --bg-glass: rgba(22, 22, 42, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6c6c8a;
    --border-color: #2a2a4a;
    --accent-primary: #6c5ce7;
    --accent-secondary: #a29bfe;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --glow: 0 0 20px rgba(108, 92, 231, 0.15);
    --sidebar-bg: #0d0d1a;
    --sidebar-hover: rgba(108, 92, 231, 0.1);
    --sidebar-active: rgba(108, 92, 231, 0.2);
}

[data-bs-theme="light"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f8;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.9);
    --text-primary: #1a1a2e;
    --text-secondary: #5a5a7a;
    --text-muted: #8a8aaa;
    --border-color: #e8eaf0;
    --accent-primary: #6c5ce7;
    --accent-secondary: #a29bfe;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --glow: 0 0 20px rgba(108, 92, 231, 0.1);
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-active: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

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

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin var(--transition-speed) ease;
}

.app-container.sidebar-collapsed .app-main {
    margin-left: 0;
}

/* Sidebar */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #0d0d1a;
    border-right: 1px solid #2a2a4a;
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: transform var(--transition-speed) ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #2a2a4a;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    box-shadow: var(--glow);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.brand-version {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-body::-webkit-scrollbar {
    width: 4px;
}

.sidebar-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-section {
    padding: 12px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #6c6c8a;
    font-weight: 600;
}

.menu-item {
    margin: 2px 8px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    color: #a0a0b8;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    position: relative;
}

.menu-link:hover {
    background: rgba(108, 92, 231, 0.1);
    color: #ffffff;
}

.menu-item.active .menu-link {
    background: rgba(108, 92, 231, 0.2);
    color: #a29bfe;
    font-weight: 500;
}

.menu-item.active .menu-link::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 2px;
}

.menu-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.menu-label {
    flex: 1;
}

.menu-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #2a2a4a;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.user-role {
    font-size: 11px;
    color: #6c6c8a;
}

/* Top Navigation */
.app-topnav {
    height: var(--topnav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topnav-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.global-search {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.global-search .bi-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.global-search input {
    padding-left: 36px;
    padding-right: 60px;
    height: 38px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 14px;
}

.global-search input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.search-hint {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    padding: 2px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
}

.topnav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topnav-item {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    font-size: 18px;
    border: none;
    background: none;
}

.topnav-project {
    width: auto;
    padding: 0 12px;
    gap: 8px;
}

.topnav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 2px solid var(--bg-glass);
}

.topnav-profile .btn {
    padding: 4px 12px;
    border: none;
    color: var(--text-primary);
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

/* Main Content */
.app-content {
    padding: 24px;
    min-height: calc(100vh - var(--topnav-height));
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Stats Widget */
.stat-card {
    padding: 20px;
    border-radius: var(--border-radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.stat-icon.primary { background: rgba(108, 92, 231, 0.15); color: #6c5ce7; }
.stat-icon.success { background: rgba(0, 201, 167, 0.15); color: #00c9a7; }
.stat-icon.warning { background: rgba(255, 183, 77, 0.15); color: #ffb74d; }
.stat-icon.danger { background: rgba(255, 82, 82, 0.15); color: #ff5252; }
.stat-icon.info { background: rgba(41, 182, 246, 0.15); color: #29b6f6; }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-change {
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
}

.stat-change.up { color: #00c9a7; }
.stat-change.down { color: #ff5252; }

/* Tables */
.table {
    color: var(--text-primary);
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 16px;
}

.table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-color: var(--border-color);
}

.table-hover tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Buttons */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    padding: 8px 20px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    border: none;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

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

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

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 12px;
}

.bg-success { background: #00c9a7 !important; }
.bg-warning { background: #ffb74d !important; }
.bg-danger { background: #ff5252 !important; }
.bg-info { background: #29b6f6 !important; }

/* Forms */
.form-control, .form-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0a0a0f 100%);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--shadow);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin: 0 auto 16px;
    box-shadow: var(--glow);
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Monaco / Query Editor */
.query-workspace {
    display: flex;
    height: calc(100vh - var(--topnav-height) - 48px);
    gap: 0;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.db-explorer {
    width: 280px;
    min-width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.db-explorer-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.db-explorer-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.db-explorer-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.db-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.db-tree li {
    padding: 6px 8px;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.db-tree li:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.db-tree li .tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.query-editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.query-editor-toolbar {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
}

.query-editor-area {
    flex: 1;
    position: relative;
    min-height: 200px;
}

.query-editor-area textarea {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    resize: none;
    outline: none;
    line-height: 1.6;
}

.query-results-panel {
    height: 250px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.query-results-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    padding: 0 8px;
}

.query-results-tabs .tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.query-results-tabs .tab:hover {
    color: var(--text-primary);
}

.query-results-tabs .tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.query-results-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.3s ease forwards;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Loading States */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Dropdown */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow);
    padding: 8px;
}

.dropdown-item {
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    font-size: 14px;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.dropdown-divider {
    border-color: var(--border-color);
}

/* Responsive */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0 !important;
    }

    .app-content {
        padding: 16px;
    }

    .global-search {
        max-width: 200px;
    }

    .query-workspace {
        flex-direction: column;
        height: auto;
    }

    .db-explorer {
        width: 100%;
        min-width: 100%;
        max-height: 200px;
    }
}

@media (max-width: 575.98px) {
    .app-topnav {
        padding: 0 12px;
    }

    .global-search {
        max-width: 140px;
    }

    .search-hint {
        display: none;
    }
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: calc(100vh - 200px);
}

.kanban-column {
    flex: 1;
    min-width: 260px;
    max-width: 320px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.kanban-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
}

.kanban-header.todo { background: rgba(108, 92, 231, 0.1); color: #8b5cf6; }
.kanban-header.in-progress { background: rgba(41, 182, 246, 0.1); color: #29b6f6; }
.kanban-header.done { background: rgba(0, 201, 167, 0.1); color: #00c9a7; }
.kanban-header.blocked { background: rgba(255, 82, 82, 0.1); color: #ff5252; }
.kanban-header.cancelled { background: rgba(158, 158, 158, 0.1); color: #9e9e9e; }

.kanban-count {
    margin-left: auto;
    background: var(--bg-tertiary);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.kanban-body {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    min-height: 200px;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
}

.kanban-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    margin-bottom: 8px;
    background: none;
    border: none;
}

.kanban-card .card-body {
    padding: 0;
    margin-bottom: 8px;
}

.kanban-card .card-footer {
    padding: 0;
    background: none;
    border: none;
}

.kanban-column.drag-over {
    background: rgba(108, 92, 231, 0.05);
    border-color: var(--accent-primary);
}

/* Kanban responsive */
@media (max-width: 991.98px) {
    .kanban-board {
        flex-direction: column;
        overflow-x: hidden;
    }
    .kanban-column {
        max-width: none;
    }
}

/* Chat Modal */
.chat-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.chat-modal-overlay.show {
    display: flex;
}

.chat-modal {
    width: 100%;
    max-width: 900px;
    height: 80vh;
    max-height: 700px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.chat-modal-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-modal-title i {
    color: var(--accent-primary);
    font-size: 20px;
}

.chat-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
}

.chat-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.chat-modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.chat-sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

.chat-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.chat-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.chat-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.chat-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.chat-sidebar-search {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.chat-sidebar-search input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

.chat-sidebar-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.chat-users-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.chat-user-item:hover {
    background: var(--bg-tertiary);
}

.chat-user-item.active {
    background: rgba(108, 92, 231, 0.15);
}

.chat-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.chat-user-avatar.online {
    position: relative;
}

.chat-user-avatar.online::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #00c9a7;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.chat-user-info {
    flex: 1;
    min-width: 0;
}

.chat-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-user-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.chat-user-time {
    font-size: 11px;
    color: var(--text-muted);
}

.chat-user-unread {
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 40px;
    text-align: center;
}

.chat-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.chat-empty-state p {
    font-size: 14px;
    margin-bottom: 8px;
}

.chat-empty-state span {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-header-status {
    font-size: 12px;
    color: #00c9a7;
}

.chat-header-status.offline {
    color: var(--text-muted);
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.chat-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    gap: 10px;
    max-width: 80%;
}

.chat-message.sent {
    margin-left: auto;
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.chat-message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-message-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message:not(.sent) .chat-message-bubble {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-message.sent .chat-message-bubble {
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message-file {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-message-file:hover {
    background: var(--bg-secondary);
}

.chat-message-file i {
    font-size: 24px;
    color: var(--accent-primary);
}

.chat-message-file-info {
    flex: 1;
}

.chat-message-file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.chat-message-file-size {
    font-size: 11px;
    color: var(--text-muted);
}

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.chat-message.sent .chat-message-meta {
    justify-content: flex-end;
}

.chat-message-status {
    color: var(--accent-primary);
}

.chat-input-area {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 100px;
    min-height: 22px;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-file-upload {
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.2s;
}

.chat-file-upload:hover {
    background: var(--bg-secondary);
    color: var(--accent-primary);
}

.chat-file-upload input {
    display: none;
}

.chat-send-btn {
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Notifications Panel */
.notifications-panel {
    position: fixed;
    top: var(--topnav-height);
    right: 20px;
    width: 400px;
    max-height: calc(100vh - 100px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow);
    z-index: 1060;
    display: none;
    overflow: hidden;
}

.notifications-panel.show {
    display: block;
}

.notifications-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.notifications-panel-title {
    font-size: 14px;
    font-weight: 600;
}

.mark-all-read-btn {
    font-size: 12px;
    color: var(--accent-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.mark-all-read-btn:hover {
    background: rgba(108, 92, 231, 0.1);
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.notification-item:hover {
    background: var(--bg-tertiary);
}

.notification-item.unread {
    background: rgba(108, 92, 231, 0.08);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.notification-icon.success { background: rgba(0, 201, 167, 0.15); color: #00c9a7; }
.notification-icon.error { background: rgba(255, 82, 82, 0.15); color: #ff5252; }
.notification-icon.warning { background: rgba(255, 183, 77, 0.15); color: #ffb74d; }
.notification-icon.info { background: rgba(41, 182, 246, 0.15); color: #29b6f6; }

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-message {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted);
}

.notifications-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.notifications-empty i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.notifications-empty p {
    font-size: 13px;
}

/* Responsive for Chat */
@media (max-width: 768px) {
    .chat-modal {
        height: 100vh;
        max-height: none;
        max-width: none;
        border-radius: 0;
    }

    .chat-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .chat-sidebar.show {
        transform: translateX(0);
    }

    .notifications-panel {
        right: 10px;
        left: 10px;
        width: auto;
    }
}
