/* PulseBot Modern Dark Theme */
:root {
    /* Core Colors - Simple & Clean */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-elevated: #1a1a24;
    --bg-input: #1e1e28;
    
    /* Accent - Single Primary Color */
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-muted: rgba(99, 102, 241, 0.15);
    
    /* Status Colors */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    
    /* Spacing */
    --sidebar-width: 280px;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
}

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

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    padding: 1.5rem 1rem;
}

.sidebar-header {
    padding: 0 0.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
}
.sidebar-brand i { color: var(--accent); }

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.25rem;
}

/* Custom Scrollbar */
.sidebar-content::-webkit-scrollbar { width: 4px; }
.sidebar-content::-webkit-scrollbar-track { background: transparent; }
.sidebar-content::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 2px; }

/* Navigation Groups */
.nav-group { margin-bottom: 1.5rem; }
.nav-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

/* Nav Links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.125rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}
.nav-link i { width: 18px; text-align: center; font-size: 0.9rem; opacity: 0.7; }
.nav-link span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-link:hover {
    background: var(--accent-muted);
    color: var(--text-primary);
}
.nav-link:hover i { opacity: 1; color: var(--accent); }

.nav-link.active {
    background: var(--accent);
    color: white;
}
.nav-link.active i { opacity: 1; color: white; }

/* Chat Photo Icons in Sidebar */
.chat-photo-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.chat-initial-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-muted);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}
.chat-avatar-lg {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.user-profile-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.avatar-circle {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.user-name-text {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-width: 0;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body { padding: 1.25rem; }

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
    background: var(--bg-input) !important;
    border: 1px solid var(--border);
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    background: var(--bg-input) !important;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
    color: var(--text-primary) !important;
}

.form-control::placeholder { color: var(--text-muted); }

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.input-group-text {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border);
    color: var(--text-secondary) !important;
    font-size: 0.8125rem;
}

/* Switches */
.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border);
    width: 2.5rem;
    height: 1.25rem;
}
.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--accent-muted);
    border-color: var(--accent);
}
.form-check-label { font-size: 0.875rem; color: var(--text-primary); }

textarea.form-control { min-height: 100px; resize: vertical; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--accent);
    border: none;
    color: white;
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: white;
}

.btn-secondary {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-secondary:hover {
    background: var(--bg-input);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-success { background: var(--success); border: none; color: white; }
.btn-success:hover { background: #16a34a; color: white; }

.btn-danger { background: var(--danger); border: none; color: white; }
.btn-danger:hover { background: #dc2626; color: white; }

.btn-warning { background: var(--warning); border: none; color: #1a1a24; }
.btn-warning:hover { background: #d97706; color: #1a1a24; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ============================================
   TABLES
   ============================================ */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-secondary);
    --bs-table-border-color: var(--border);
    margin-bottom: 0;
}

.table th {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.table td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.table-hover tbody tr:hover { background: var(--accent-muted); }

/* ============================================
   TABS
   ============================================ */
.nav-pills .nav-link {
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
}
.nav-pills .nav-link:hover { color: var(--text-primary); background: var(--accent-muted); }
.nav-pills .nav-link.active { background: var(--accent); color: white; }

.tab-scroller {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

/* ============================================
   BADGES
   ============================================ */
.badge { font-weight: 500; font-size: 0.75rem; padding: 0.35rem 0.6rem; border-radius: var(--radius-sm); }
.badge.bg-primary { background: var(--accent) !important; }
.badge.bg-success { background: var(--success) !important; }
.badge.bg-danger { background: var(--danger) !important; }
.badge.bg-warning { background: var(--warning) !important; color: #1a1a24 !important; }
.badge.bg-secondary { background: var(--bg-elevated) !important; color: var(--text-secondary) !important; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border-radius: var(--radius-md);
    border: none;
    font-size: 0.875rem;
}
.alert-success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.alert-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.alert-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }

/* ============================================
   MODALS
   ============================================ */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
}
.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem;
}
.modal-title { font-weight: 600; color: var(--text-primary); }
.modal-body { padding: 1.25rem; color: var(--text-secondary); }
.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
}
.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ============================================
   UTILITIES
   ============================================ */
h1, h2, h3, h4, h5, h6 { color: var(--text-primary); font-weight: 600; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

.hover-primary:hover { color: var(--accent) !important; }
.hover-danger:hover { color: var(--danger) !important; }

/* List Groups */
.list-group-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    transition: all 0.15s ease;
}
.list-group-item:hover {
    background: var(--accent-muted);
    color: var(--text-primary);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1rem; }
    
    #sidebarToggle {
        display: flex !important;
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        z-index: 99;
    }
}

@media (min-width: 993px) {
    #sidebarToggle { display: none !important; }
}

/* ============================================
   TOOLTIPS
   ============================================ */
.tooltip-inner {
    max-width: 280px;
    padding: 0.5rem 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    text-align: left;
}

/* ============================================
   PAGE SPECIFIC - Dashboard
   ============================================ */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: border-color 0.15s ease;
}
.stat-card:hover { border-color: var(--accent); }
.stat-card h2 { font-size: 2.5rem; font-weight: 700; margin: 0; }
.stat-card .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.chat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.15s ease;
}
.chat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ============================================
   SETTING TOGGLES (Enhanced)
   ============================================ */
.setting-toggle {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.15s ease;
}
.setting-toggle:hover { border-color: var(--border-hover); }
.setting-toggle.active { border-color: var(--accent); background: var(--accent-muted); }
.setting-toggle .title { font-weight: 600; color: var(--text-primary); font-size: 0.875rem; }
.setting-toggle .desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
