/* ============================================
   Roejin Support Console - Main Stylesheet
   ============================================ */

/* === CSS Variables / Theme === */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #0ea5e9;
    --accent-color: #8b5cf6;
    
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    --text-white: #ffffff;
    
    --border-color: #e2e8f0;
    --border-radius-sm: 4px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --sidebar-width: 260px;
    --header-height: 60px;
    --transition: all 0.2s ease;
}

/* === Dark Mode Support === */
[data-theme="dark"] {
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
}

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* === Login Page === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    padding: 40px 40px 30px;
    text-align: center;
    color: white;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    overflow: hidden;
}

.login-logo img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.login-header p {
    opacity: 0.85;
    font-size: 0.95rem;
}

.login-body {
    padding: 40px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-tertiary);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.alert-warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* === Main Layout === */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.sidebar-brand h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.sidebar-brand small {
    font-size: 0.75rem;
    opacity: 0.6;
    font-weight: 400;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    cursor: pointer;
    gap: 12px;
    font-size: 0.9rem;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: white;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.3), transparent);
    color: white;
    border-left: 3px solid var(--primary-color);
}

.nav-item .icon {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--danger-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    opacity: 0.6;
}

/* === Main Content Area === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* === Header / Top Bar === */
.top-header {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.search-bar {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 8px 16px 8px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    background: var(--bg-secondary);
    font-size: 0.9rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-bar .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
    position: relative;
}

.header-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.header-btn .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
}

/* === Page Content === */
.page-content {
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* === Cards === */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* === Dashboard Stats === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.cyan { background: #cffafe; color: #0891b2; }

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* === Tables === */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

/* === Status Badges === */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
}

.badge-open { background: #dbeafe; color: #1d4ed8; }
.badge-in_progress, .badge-active { background: #fef3c7; color: #92400e; }
.badge-resolved { background: #dcfce7; color: #16a34a; }
.badge-closed { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-waiting { background: #ffedd5; color: #c2410c; }
.badge-on_hold, .badge-hold { background: #f3e8ff; color: #7c3aed; }
.badline-critical { background: #fee2e2; color: #dc2626; }
.badge-high { background: #fed7aa; color: #c2410c; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-low { background: #dbeafe; color: #1d4ed8; }
.badge-online { background: #dcfce7; color: #16a34a; }
.badge-away { background: #fef3c7; color: #92400e; }
.badge-busy, .badge-on_call { background: #fee2e2; color: #dc2626; }
.badge-offline { background: var(--bg-tertiary); color: var(--text-secondary); }

/* === Grid Layouts === */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* === Tabs === */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    gap: 4px;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* === Chat Widget Styles === */
.chat-container {
    display: flex;
    height: calc(100vh - var(--header-height) - 48px);
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.chat-list-panel {
    width: 320px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.chat-list-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.chat-list-body {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.chat-item:hover {
    background: var(--bg-secondary);
}

.chat-item.active {
    background: #dbeafe;
    border-left: 3px solid var(--primary-color);
}

.chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.chat-preview {
    flex: 1;
    min-width: 0;
}

.chat-preview .name {
    font-weight: 500;
    font-size: 0.9rem;
}

.chat-preview .last-message {
    color: var(--text-muted);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    text-align: right;
    flex-shrink: 0;
}

.chat-meta .time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-meta .unread-count {
    background: var(--primary-color);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    display: inline-block;
    margin-top: 4px;
}

.chat-main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header-bar {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-secondary);
}

.message-bubble {
    max-width: 70%;
    margin-bottom: 12px;
    display: flex;
}

.message-bubble.agent {
    justify-content: flex-end;
}

.message-bubble.visitor {
    justify-content: flex-start;
}

.message-content {
    padding: 10px 16px;
    border-radius: var(--border-radius-lg);
    font-size: 0.9rem;
    line-height: 1.5;
}

.message-bubble.visitor .message-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-bubble.agent .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 4px;
}

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    font-size: 0.9rem;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* === Chat Widget (for website embed) === */
.rwj-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.rwj-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.rwj-chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    height: 500px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.rwj-chat-window.open {
    display: flex;
}

/* === Remote Session Styles === */
.remote-panel {
    background: #000;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    position: relative;
}

.remote-toolbar {
    background: #1a1a2e;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #333;
}

.remote-toolbar .tool-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    border: 1px solid #444;
    background: transparent;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remote-toolbar .tool-btn:hover {
    background: var(--primary-color);
}

.remote-viewer {
    width: 100%;
    height: calc(100vh - 200px);
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* === Client Profile Panel === */
.client-profile {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
}

.client-sidebar-card {
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

.client-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 auto 16px;
}

.client-detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.client-detail-label {
    width: 100px;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.client-detail-value {
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* === Notes Area === */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.note-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 16px;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.note-card:hover {
    box-shadow: var(--shadow-md);
}

.note-card.pinned {
    border-left-color: var(--warning-color);
    background: #fffbeb;
}

.note-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.note-content {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.note-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === Modal / Dialog === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-dialog {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* === Pagination === */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
}

.page-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* === Agent Status Indicator === */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online { background: var(--success-color); }
.status-dot.away { background: var(--warning-color); }
.status-dot.busy { background: var(--danger-color); }
.status-dot.offline { background: var(--text-muted); }

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* === Responsive === */
@media (max-width: 1024px) {
    .client-profile {
        grid-template-columns: 1fr;
    }
    
    .chat-list-panel {
        width: 260px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header-toggle {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chat-list-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .chat-container {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-content {
        padding: 16px;
    }
}

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-in-right {
    animation: slideInRight 0.3s ease;
}

/* === Utility Classes === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.fw-bold { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-100 { width: 100%; }