/* VertexChat - Fixed Width with Persistent Storage and Enhanced Calls */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== THEME DEFINITIONS ===== */
:root {
    --primary: #667eea;
    --primary-dark: #5a6fd8;
    --primary-light: #8b9ff5;
    --secondary: #764ba2;
    --background: #f7fafc;
    --surface: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --text-lighter: #a0aec0;
    --border: #e2e8f0;
    --success: #48bb78;
    --warning: #ed8936;
    --error: #f56565;
    --info: #4299e1;
    --header-bg: #2d3748;
    --header-text: #ffffff;
}

/* Dark theme */
:root[data-theme="dark"] {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #8b5cf6;
    --secondary: #a78bfa;
    --background: #111827;
    --surface: #1f2937;
    --text: #f9fafb;
    --text-light: #9ca3af;
    --text-lighter: #6b7280;
    --border: #374151;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --header-bg: #000000;
    --header-text: #ffffff;
}

/* Blue theme */
:root[data-theme="blue"] {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #38bdf8;
    --secondary: #06b6d4;
    --background: #f0f9ff;
    --surface: #ffffff;
    --text: #0c4a6e;
    --text-light: #0369a1;
    --text-lighter: #0ea5e9;
    --border: #bae6fd;
    --success: #14b8a6;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #0ea5e9;
    --header-bg: #0c4a6e;
    --header-text: #ffffff;
}

/* Green theme */
:root[data-theme="green"] {
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --primary-light: #4ade80;
    --secondary: #4ade80;
    --background: #f0fdf4;
    --surface: #ffffff;
    --text: #14532d;
    --text-light: #15803d;
    --text-lighter: #22c55e;
    --border: #bbf7d0;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #22c55e;
    --header-bg: #14532d;
    --header-text: #ffffff;
}

/* Pink theme */
:root[data-theme="pink"] {
    --primary: #ec4899;
    --primary-dark: #db2777;
    --primary-light: #f472b6;
    --secondary: #f472b6;
    --background: #fdf2f8;
    --surface: #ffffff;
    --text: #831843;
    --text-light: #9d174d;
    --text-lighter: #ec4899;
    --border: #fbcfe8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #ec4899;
    --header-bg: #831843;
    --header-text: #ffffff;
}

/* Purple theme */
:root[data-theme="purple"] {
    --primary: #a855f7;
    --primary-dark: #9333ea;
    --primary-light: #c084fc;
    --secondary: #c084fc;
    --background: #faf5ff;
    --surface: #ffffff;
    --text: #581c87;
    --text-light: #7e22ce;
    --text-lighter: #a855f7;
    --border: #e9d5ff;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #a855f7;
    --header-bg: #581c87;
    --header-text: #ffffff;
}

/* Orange theme */
:root[data-theme="orange"] {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: #fb923c;
    --secondary: #fb923c;
    --background: #fff7ed;
    --surface: #ffffff;
    --text: #7c2d12;
    --text-light: #c2410c;
    --text-lighter: #f97316;
    --border: #fed7aa;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #f97316;
    --header-bg: #7c2d12;
    --header-text: #ffffff;
}

/* ===== BASE STYLES ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text);
    overflow-x: hidden;
    transition: background 0.3s ease;
}

/* ===== APP CONTAINER ===== */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    height: 90vh; /* Changed from min-height to fixed height */
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* ===== HEADER ===== */
.header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease, color 0.3s ease;
    flex-shrink: 0;
    height: 70px; /* Fixed height for header */
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-secondary {
    background: var(--text-light);
    color: white;
}

.btn-secondary:hover {
    background: var(--text);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    display: flex;
    flex: 1;
    min-height: 0; /* Important for flex children to respect overflow */
    overflow: hidden; /* Prevent main content from scrolling */
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background: var(--background);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    transition: background 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.section {
    padding: 20px 15px;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.3s ease;
    flex-shrink: 0;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 12px;
}

.list-item {
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.list-item.active {
    background: var(--primary);
    color: white;
}

.user-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-online { background: var(--success); }
.status-offline { background: var(--text-light); }

/* ===== CHAT AREA ===== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0; /* Important for flex children */
    overflow: hidden; /* Prevent chat area from scrolling */
}

.chat-header {
    padding: 18px 25px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    flex-shrink: 0;
    height: 80px; /* Fixed height for chat header */
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.chat-header-left > span {
    color: var(--text);
}

.chat-header-left #channelName {
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-left #channelDesc {
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Fixed messages container with scroll */
.messages-container {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    background: var(--background);
    min-height: 0; /* Important for flex child */
    display: flex;
    flex-direction: column;
}

.messages-scroll-area {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.message {
    margin-bottom: 18px;
    padding: 16px 18px;
    background: var(--surface);
    border-radius: 16px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex-shrink: 0; /* Prevent messages from shrinking */
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    align-items: flex-start;
}

.message-author {
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    max-width: 70%;
}

.message-time {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.message-text {
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: var(--text);
    width: 100%;
}

.message.own {
    border-left-color: var(--success);
    background: rgba(72, 187, 120, 0.1);
}

.message.system {
    border-left-color: var(--warning);
    background: rgba(237, 137, 54, 0.1);
    text-align: center;
}

.message.call-log {
    border-left-color: var(--info);
    background: rgba(66, 153, 225, 0.1);
    text-align: center;
    font-style: italic;
}

.delete-btn {
    background: var(--error);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    flex-shrink: 0;
}

/* ===== INPUT AREA ===== */
.input-area {
    padding: 20px 25px;
    border-top: 2px solid var(--border);
    display: flex;
    gap: 12px;
    background: var(--surface);
    flex-shrink: 0;
    height: 90px; /* Fixed height for input area */
}

.message-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--border);
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    background: var(--background);
    color: var(--text);
    transition: all 0.3s ease;
    min-width: 0;
}

.message-input:focus {
    border-color: var(--primary);
}

.send-button {
    padding: 14px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== LOGIN OVERLAY ===== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-form {
    background: var(--surface);
    padding: 45px;
    border-radius: 20px;
    width: 420px;
    max-width: 90%;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text);
}

.login-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border);
}

.login-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
    color: var(--text);
    transition: all 0.2s;
}

.login-tab:hover {
    background: var(--background);
}

.login-tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    background: var(--background);
    color: var(--text);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--text);
    text-align: center;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-buttons .btn {
    flex: 1;
}

/* ===== ADMIN PANEL STYLES ===== */
.admin-panel {
    max-width: 800px;
    min-height: 600px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.admin-header h3 {
    margin: 0;
    color: var(--text);
}

.admin-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 25px;
}

.admin-tab {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s;
}

.admin-tab:hover {
    color: var(--text);
}

.admin-tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--background);
    padding: 25px 20px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid var(--border);
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 600;
}

.stats-details {
    margin-top: 25px;
    background: var(--background);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid var(--border);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--surface);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

/* Users List */
.users-list {
    max-height: 400px;
    overflow-y: auto;
}

.admin-user-item {
    background: var(--background);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 2px solid var(--border);
    transition: all 0.2s;
}

.admin-user-item:hover {
    border-color: var(--primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.user-role {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.user-role.admin {
    background: var(--warning);
    color: white;
}

.user-role.user {
    background: var(--info);
    color: white;
}

.user-role.bot {
    background: var(--success);
    color: white;
}

.user-meta {
    font-size: 12px;
    color: var(--text-light);
}

.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

/* Endpoints List */
.endpoints-list {
    max-height: 400px;
    overflow-y: auto;
}

.endpoints-list h4 {
    margin: 20px 0 12px 0;
    color: var(--primary);
    font-size: 16px;
}

.endpoints-list h4:first-child {
    margin-top: 0;
}

.endpoints-category {
    margin-bottom: 25px;
}

.endpoint-item {
    background: var(--background);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid var(--primary);
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* Tools Section */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.tool-section {
    background: var(--background);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid var(--border);
}

.tool-section h4 {
    margin-bottom: 12px;
    color: var(--text);
}

.tool-section p {
    color: var(--text-light);
    margin-bottom: 15px;
    line-height: 1.5;
}

.tool-section .form-input {
    margin-bottom: 10px;
}

.backup-section {
    text-align: center;
}

.backup-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 25px 0;
}

.backup-info {
    background: var(--background);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid var(--border);
    text-align: left;
}

.backup-info h5 {
    margin-bottom: 10px;
    color: var(--text);
}

.backup-info p {
    margin-bottom: 10px;
    color: var(--text-light);
    line-height: 1.5;
}

/* ===== NOTIFICATION ===== */
.notification {
    position: fixed;
    top: 25px;
    right: 25px;
    padding: 16px 24px;
    background: var(--success);
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 2000;
    transform: translateX(500px);
    transition: transform 0.3s;
    font-weight: 600;
    max-width: 400px;
    word-wrap: break-word;
}

.notification.show {
    transform: translateX(0);
}

.notification.error { background: var(--error); }
.notification.warning { background: var(--warning); }
.notification.info { background: var(--info); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
}

.empty-state h3 {
    margin-bottom: 12px;
    color: var(--text);
    font-size: 24px;
}

.empty-state p {
    color: var(--text-light);
    font-size: 16px;
}

/* ===== THEME SWITCHER ===== */
.theme-switcher {
    position: relative;
}

.theme-button {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.theme-button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.theme-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: none;
    z-index: 1000;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.theme-menu.show {
    display: block;
}

.theme-option {
    padding: 10px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    color: var(--text);
    font-weight: 500;
}

.theme-option:hover {
    background: var(--background);
}

.theme-option.active {
    background: var(--primary);
    color: white;
}

/* ===== DM BADGE ===== */
.dm-badge {
    background: var(--error);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ===== CALL INTERFACE STYLES ===== */
.call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    display: none;
}

.call-overlay.active {
    display: block;
}

.incoming-call {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--surface);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 2500;
    display: none;
    min-width: 300px;
    max-width: 90vw;
    border-left: 5px solid var(--primary);
}

.incoming-call.active {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.call-interface {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    z-index: 3000;
    display: none;
    min-width: 500px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    border: 3px solid var(--primary);
}

.call-interface.active {
    display: block;
}

.call-header {
    text-align: center;
    margin-bottom: 25px;
}

.call-status {
    font-size: 16px;
    color: var(--text-light);
    margin: 10px 0;
    font-weight: 500;
}

.call-participants {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    max-height: 400px;
    overflow-y: auto;
}

.participant {
    background: var(--background);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    border: 2px solid var(--border);
    transition: all 0.2s;
}

.participant:hover {
    border-color: var(--primary);
}

.participant-video {
    width: 100%;
    height: 200px;
    background: #000;
    border-radius: 8px;
    margin-bottom: 10px;
    object-fit: cover;
}

.participant-screen {
    width: 100%;
    height: 200px;
    background: #000;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 2px solid var(--primary);
    object-fit: contain;
}

.participant-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}

.participant-status {
    font-size: 12px;
    color: var(--text-light);
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-btn.accept {
    background: var(--success);
    color: white;
}

.call-btn.reject {
    background: var(--error);
    color: white;
}

.call-btn.mute {
    background: var(--warning);
    color: white;
}

.call-btn.video {
    background: var(--info);
    color: white;
}

.call-btn.screen {
    background: var(--primary);
    color: white;
}

.call-btn:hover {
    transform: scale(1.1);
}

.call-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.call-timer {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin: 15px 0;
}

.call-quality {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    z-index: 10;
}

.quality-excellent { color: var(--success); }
.quality-good { color: var(--info); }
.quality-poor { color: var(--warning); }
.quality-bad { color: var(--error); }

.call-reconnect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    z-index: 20;
}

/* ===== CALL PREVIEW ===== */
.call-preview {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 250px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 1500;
    display: none;
    overflow: hidden;
    transition: all 0.3s ease;
}

.call-preview.active {
    display: block;
}

.call-preview.minimized {
    width: 60px;
    height: 60px;
}

.call-preview.minimized .preview-header,
.call-preview.minimized .preview-placeholder,
.call-preview.minimized video {
    display: none;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.preview-header .minimize-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-preview video {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: none;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 150px;
    background: var(--background);
    color: var(--text-light);
}

.placeholder-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.placeholder-text {
    font-size: 12px;
    text-align: center;
}

/* Small call buttons in user list */
.call-btn-small {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.call-btn-small:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

/* Call quality indicators */
.connection-quality {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    z-index: 5;
}

.quality-good { color: var(--success); }
.quality-fair { color: var(--warning); }
.quality-poor { color: var(--error); }

/* Local video preview */
.local-video {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 150px;
    height: 100px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    z-index: 10;
}

/* ===== ENHANCED SCROLLBAR STYLES ===== */
.messages-scroll-area::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar,
.call-participants::-webkit-scrollbar,
.users-list::-webkit-scrollbar,
.endpoints-list::-webkit-scrollbar,
.admin-panel::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.admin-tab-content::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.messages-scroll-area::-webkit-scrollbar-track,
.sidebar-content::-webkit-scrollbar-track,
.call-participants::-webkit-scrollbar-track,
.users-list::-webkit-scrollbar-track,
.endpoints-list::-webkit-scrollbar-track,
.admin-panel::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
.admin-tab-content::-webkit-scrollbar-track {
    background: linear-gradient(135deg, var(--background) 0%, var(--surface) 100%);
    border-radius: 8px;
    margin: 4px;
}

.messages-scroll-area::-webkit-scrollbar-thumb,
.sidebar-content::-webkit-scrollbar-thumb,
.call-participants::-webkit-scrollbar-thumb,
.users-list::-webkit-scrollbar-thumb,
.endpoints-list::-webkit-scrollbar-thumb,
.admin-panel::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.admin-tab-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 8px;
    border: 2px solid var(--surface);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.messages-scroll-area::-webkit-scrollbar-thumb:hover,
.sidebar-content::-webkit-scrollbar-thumb:hover,
.call-participants::-webkit-scrollbar-thumb:hover,
.users-list::-webkit-scrollbar-thumb:hover,
.endpoints-list::-webkit-scrollbar-thumb:hover,
.admin-panel::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover,
.admin-tab-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: scale(1.05);
}

.messages-scroll-area::-webkit-scrollbar-corner,
.sidebar-content::-webkit-scrollbar-corner,
.call-participants::-webkit-scrollbar-corner,
.users-list::-webkit-scrollbar-corner,
.endpoints-list::-webkit-scrollbar-corner,
.admin-panel::-webkit-scrollbar-corner,
.modal-content::-webkit-scrollbar-corner,
.admin-tab-content::-webkit-scrollbar-corner {
    background: var(--background);
    border-radius: 0 0 8px 0;
}

/* Firefox scrollbar styles */
.messages-scroll-area,
.sidebar-content,
.call-participants,
.users-list,
.endpoints-list,
.admin-panel,
.modal-content,
.admin-tab-content {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--background);
}

/* Smooth scrolling for all scrollable elements */
.messages-scroll-area,
.sidebar-content,
.call-participants,
.users-list,
.endpoints-list,
.admin-panel,
.modal-content,
.admin-tab-content {
    scroll-behavior: smooth;
}

/* Enhanced scrollbar for mobile */
@media (max-width: 768px) {
    .messages-scroll-area::-webkit-scrollbar,
    .sidebar-content::-webkit-scrollbar,
    .call-participants::-webkit-scrollbar,
    .users-list::-webkit-scrollbar,
    .endpoints-list::-webkit-scrollbar,
    .admin-panel::-webkit-scrollbar,
    .modal-content::-webkit-scrollbar,
    .admin-tab-content::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    
    .messages-scroll-area::-webkit-scrollbar-thumb,
    .sidebar-content::-webkit-scrollbar-thumb,
    .call-participants::-webkit-scrollbar-thumb,
    .users-list::-webkit-scrollbar-thumb,
    .endpoints-list::-webkit-scrollbar-thumb,
    .admin-panel::-webkit-scrollbar-thumb,
    .modal-content::-webkit-scrollbar-thumb,
    .admin-tab-content::-webkit-scrollbar-thumb {
        border: 1px solid var(--surface);
    }
}

/* Active scrollbar state */
.messages-scroll-area::-webkit-scrollbar-thumb:active,
.sidebar-content::-webkit-scrollbar-thumb:active,
.call-participants::-webkit-scrollbar-thumb:active,
.users-list::-webkit-scrollbar-thumb:active,
.endpoints-list::-webkit-scrollbar-thumb:active,
.admin-panel::-webkit-scrollbar-thumb:active,
.modal-content::-webkit-scrollbar-thumb:active,
.admin-tab-content::-webkit-scrollbar-thumb:active {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary) 100%);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* Scrollbar animation */
@keyframes scrollbarPulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.messages-scroll-area::-webkit-scrollbar-thumb:hover,
.sidebar-content::-webkit-scrollbar-thumb:hover,
.call-participants::-webkit-scrollbar-thumb:hover {
    animation: scrollbarPulse 2s infinite;
}

/* Dark theme specific scrollbar adjustments */
:root[data-theme="dark"] .messages-scroll-area::-webkit-scrollbar-track,
:root[data-theme="dark"] .sidebar-content::-webkit-scrollbar-track,
:root[data-theme="dark"] .call-participants::-webkit-scrollbar-track,
:root[data-theme="dark"] .users-list::-webkit-scrollbar-track,
:root[data-theme="dark"] .endpoints-list::-webkit-scrollbar-track,
:root[data-theme="dark"] .admin-panel::-webkit-scrollbar-track,
:root[data-theme="dark"] .modal-content::-webkit-scrollbar-track,
:root[data-theme="dark"] .admin-tab-content::-webkit-scrollbar-track {
    background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
}

/* Auto-hide scrollbars when not interacting */
.messages-scroll-area::-webkit-scrollbar-thumb,
.sidebar-content::-webkit-scrollbar-thumb,
.call-participants::-webkit-scrollbar-thumb,
.users-list::-webkit-scrollbar-thumb,
.endpoints-list::-webkit-scrollbar-thumb,
.admin-panel::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.admin-tab-content::-webkit-scrollbar-thumb {
    opacity: 0.7;
    transition: opacity 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.messages-scroll-area:hover::-webkit-scrollbar-thumb,
.sidebar-content:hover::-webkit-scrollbar-thumb,
.call-participants:hover::-webkit-scrollbar-thumb,
.users-list:hover::-webkit-scrollbar-thumb,
.endpoints-list:hover::-webkit-scrollbar-thumb,
.admin-panel:hover::-webkit-scrollbar-thumb,
.modal-content:hover::-webkit-scrollbar-thumb,
.admin-tab-content:hover::-webkit-scrollbar-thumb {
    opacity: 1;
}

/* Scroll indicator for new messages */
.scroll-indicator {
    position: absolute;
    bottom: 100px;
    right: 30px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 6px;
}

.scroll-indicator:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.scroll-indicator::before {
    content: '⬇️';
    font-size: 14px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .app-container {
        max-width: 95vw;
    }
    
    .sidebar {
        width: 250px;
    }
}

@media (max-width: 992px) {
    .app-container {
        max-width: 98vw;
    }
    
    .sidebar {
        width: 220px;
    }
    
    .message-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .message-author {
        max-width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body { 
        padding: 10px; 
        overflow-x: hidden;
    }
    
    .app-container { 
        border-radius: 15px; 
        height: 95vh; /* Adjusted for mobile */
        max-width: 100vw;
    }
    
    .sidebar { 
        width: 100%; 
        max-height: 30vh; 
        border-right: none; 
        border-bottom: 2px solid var(--border); 
    }
    
    .main-content { 
        flex-direction: column;
        height: auto;
    }
    
    .theme-menu {
        right: auto;
        left: 0;
    }
    
    /* Call interface responsive */
    .call-interface {
        min-width: 95vw;
        padding: 20px;
    }
    
    .call-participants {
        grid-template-columns: 1fr;
    }
    
    .incoming-call {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
    
    .call-preview {
        width: 200px;
    }
    
    .messages-container {
        padding: 15px;
    }
    
    .input-area {
        padding: 15px;
        height: 80px; /* Adjusted for mobile */
    }
    
    .header {
        padding: 12px 15px;
        height: 60px; /* Adjusted for mobile */
    }
    
    .chat-header {
        padding: 12px 15px;
        height: 70px; /* Adjusted for mobile */
    }
    
    .user-info {
        gap: 8px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-tabs {
        flex-wrap: wrap;
    }
    
    .admin-tab {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
    
    .backup-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .app-container {
        border-radius: 10px;
        height: 98vh; /* Adjusted for mobile */
    }
    
    .header {
        padding: 10px 12px;
        height: 55px; /* Adjusted for mobile */
    }
    
    .logo {
        font-size: 18px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .messages-container {
        padding: 10px;
    }
    
    .message {
        padding: 12px 14px;
        margin-bottom: 12px;
    }
    
    .input-area {
        padding: 12px;
        gap: 8px;
        height: 75px; /* Adjusted for mobile */
    }
    
    .message-input {
        padding: 12px 16px;
    }
    
    .send-button {
        padding: 12px 20px;
    }
    
    .call-interface {
        min-width: 98vw;
        padding: 15px;
    }
    
    .call-btn {
        width: 50px;
        height: 50px;
        font-size: 16px;
    }
    
    .call-preview {
        width: 180px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .admin-tabs {
        flex-direction: column;
    }
    
    .admin-tab {
        flex: none;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .users-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Selection colors */
::selection {
    background: var(--primary);
    color: white;
}

::-moz-selection {
    background: var(--primary);
    color: white;
}

/* Prevent text selection on UI elements */
.header,
.sidebar,
.list-item,
.btn,
.call-btn,
.call-btn-small,
.admin-tab {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Loading animations */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Pulse animation for active calls */
.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

/* Connection status indicators */
.connection-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.connection-connected { background: var(--success); }
.connection-connecting { background: var(--warning); }
.connection-disconnected { background: var(--error); }

/* Enhanced call controls */
.call-controls-enhanced {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.call-control-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Admin panel enhancements */
.admin-search {
    margin-bottom: 20px;
}

.admin-search input {
    width: 100%;
}

.stats-trend {
    font-size: 12px;
    margin-top: 5px;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--error); }
.trend-neutral { color: var(--text-light); }

/* Backup status */
.backup-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: left;
}

.backup-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
}

.backup-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
}

.backup-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
}

/* Call history styles */
.call-history-item {
    background: var(--background);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--info);
}

.call-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.call-history-duration {
    font-weight: 600;
    color: var(--primary);
}

.call-history-participants {
    color: var(--text-light);
    font-size: 14px;
}

/* Enhanced notification system */
.notification-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.notification-item {
    background: var(--surface);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-left: 4px solid var(--success);
    transform: translateX(500px);
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-item.show {
    transform: translateX(0);
}

.notification-item.error {
    border-left-color: var(--error);
}

.notification-item.warning {
    border-left-color: var(--warning);
}

.notification-item.info {
    border-left-color: var(--info);
}

.notification-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 14px;
    color: var(--text-light);
}

.notification-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    border-radius: 4px;
}

.notification-close:hover {
    background: var(--background);
    color: var(--text);
}

/* Enhanced user presence */
.user-presence {
    display: flex;
    align-items: center;
    gap: 8px;
}

.presence-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: relative;
}

.presence-online {
    background: var(--success);
}

.presence-offline {
    background: var(--text-light);
}

.presence-away {
    background: var(--warning);
}

.presence-busy {
    background: var(--error);
}

.presence-pulse::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    border: 2px solid;
    animation: presencePulse 2s infinite;
}

.presence-online.presence-pulse::before {
    border-color: var(--success);
}

@keyframes presencePulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* File upload styles */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 15px;
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.file-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.file-upload-icon {
    font-size: 40px;
    margin-bottom: 10px;
    color: var(--text-light);
}

.file-upload-text {
    color: var(--text-light);
    margin-bottom: 10px;
}

.file-upload-hint {
    font-size: 12px;
    color: var(--text-lighter);
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

/* Enhanced message reactions */
.message-reactions {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.reaction {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.reaction:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.reaction.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.reaction-count {
    font-weight: 600;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text-light);
    font-style: italic;
    font-size: 14px;
}

.typing-dots {
    display: flex;
    gap: 2px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-light);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Enhanced scroll to bottom button */
.scroll-to-bottom {
    position: absolute;
    bottom: 100px;
    right: 30px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s;
    z-index: 100;
}

.scroll-to-bottom:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Connection status banner */
.connection-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 20px;
    text-align: center;
    z-index: 4000;
    font-weight: 600;
    transition: transform 0.3s;
    transform: translateY(-100%);
}

.connection-banner.show {
    transform: translateY(0);
}

.connection-banner.reconnecting {
    background: var(--warning);
    color: white;
}

.connection-banner.offline {
    background: var(--error);
    color: white;
}

.connection-banner.online {
    background: var(--success);
    color: white;
}

/* Enhanced context menus */
.context-menu {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 5000;
    min-width: 160px;
    overflow: hidden;
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.context-menu-item:hover {
    background: var(--background);
}

.context-menu-item.danger {
    color: var(--error);
}

.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Enhanced audio visualizer for calls */
.audio-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 30px;
    margin: 10px 0;
}

.audio-bar {
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: height 0.1s;
}

/* Enhanced file preview */
.file-preview {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    font-size: 24px;
    color: var(--primary);
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: var(--text-light);
}

.file-download {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.file-download:hover {
    background: var(--primary-dark);
}

/* Enhanced image preview */
.image-preview {
    max-width: 300px;
    border-radius: 8px;
    overflow: hidden;
    margin: 8px 0;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* Custom scrollbar for webkit */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Print styles */
@media print {
    .header,
    .sidebar,
    .input-area,
    .call-interface,
    .modal-overlay {
        display: none !important;
    }
    
    .app-container {
        box-shadow: none;
        border-radius: 0;
    }
    
    .messages-container {
        padding: 0;
    }
    
    body {
        background: white;
        padding: 0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border: #000000;
        --text-light: #333333;
    }
    
    .message {
        border-left-width: 6px;
    }
    
    .btn {
        border: 2px solid;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .notification {
        transition: none;
    }
}

/* Enhanced video elements */
.participant-video {
    width: 100%;
    height: 300px;
    background: #000;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--primary);
}

#previewVideo {
    width: 100%;
    height: 150px;
    background: #000;
    border-radius: 0 0 10px 10px;
    object-fit: cover;
}

/* Screen share specific styles */
.screen-share-active .participant-video {
    object-fit: contain;
    background: #1a1a1a;
}

/* Video controls */
.video-controls {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.video-control-btn {
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.video-control-btn:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.1);
}

/* Improved call preview */
.call-preview video {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 150px;
    background: var(--background);
    color: var(--text-light);
}

/* Call status indicators */
.connection-quality {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    z-index: 5;
}

.quality-good { color: var(--success); }
.quality-fair { color: var(--warning); }
.quality-poor { color: var(--error); }

/* Local video preview in call */
.local-video-preview {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 150px;
    height: 100px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    z-index: 10;
    background: #000;
}

.local-video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}