﻿:root {
    /* ATAPIC Brand Colors */
    --primary-color: #000000;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary-color: #64748b;
    --accent-color: #0ea5e9;
    /* Functional Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    /* UI Colors */
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --surface-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --divider-color: #f1f5f9;
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-light: #ffffff;
    /* Chat Message Colors */
    --message-received-bg: #ffffff;
    --message-received-text: #0f172a;
    --message-sent-bg: #2563eb;
    --message-sent-text: #ffffff;
    /* Status Colors */
    --active-indicator: #10b981;
    --inactive-indicator: #94a3b8;
    --unread-badge: #ef4444;
    --typing-indicator: #0ea5e9;
    /* Transitions */
    --transition-speed: 0.2s;
    /* Spacing - Compact Version */
    --spacing-xxs: 2px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 20px;
    --spacing-xl: 24px;
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --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);
}
[data-theme="dark"] {
    /* ATAPIC Brand Colors */
    --primary-color: #4e54c8;
    --primary-hover: #3498db;
    --primary-light: rgba(219, 234, 254, 0.1);
    --secondary-color: #94a3b8;
    --accent-color: #0ea5e9;
    /* Functional Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    /* UI Colors */
    --bg-color: #1a1a1a;
    --surface-color: #2c3338;
    --surface-hover: #3f454c;
    --border-color: rgba(255,255,255,0.1);
    --divider-color: rgba(255,255,255,0.05);
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #ffffff;
    /* Chat Message Colors */
    --message-received-bg: #3f454c;
    --message-received-text: #ffffff;
    --message-sent-bg: #4e54c8;
    --message-sent-text: #ffffff;
    /* Status Colors */
    --active-indicator: #10b981;
    --inactive-indicator: #64748b;
    --unread-badge: #ef4444;
    --typing-indicator: #0ea5e9;
}
/* Global Styles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: auto; /* Allow scrolling if needed */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-color);
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
}

/* Chat Toggle Button */
.chat-toggle-button {
    position: fixed;
    bottom: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: all 0.3s ease;
}

    .chat-toggle-button:hover {
        transform: scale(1.1);
        background-color: var(--primary-hover);
    }

    .chat-toggle-button:active {
        transform: scale(0.9);
    }

.unread-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    display: none;
}

/* Chat Container */
.team-chat-wrapper {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 999;
}

.atapic-chat-wrapper.collapsed {
    display: none;
}

.atapic-chat-wrapper {
    width: 650px;
    height: 500px;
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Main Chat Container */
.atapic-chat-container {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: relative;
    flex: 1;
}

/* Connection Status */
.connection-status {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 1010;
    background-color: var(--surface-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-xs) var(--spacing-md);
    display: flex;
    align-items: center;
    font-size: 12px;
    transition: all var(--transition-speed) ease;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: var(--spacing-sm);
    background-color: var(--warning-color);
}

.connection-status.connected .status-indicator {
    background-color: var(--success-color);
}

.connection-status.disconnected .status-indicator {
    background-color: var(--danger-color);
}

.status-text {
    font-weight: 500;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 2;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.branding {
    display: flex;
    align-items: center;
}

.logo {
    width: 32px;
    height: 32px;
    background-color: #ffffff; /* Changed from var(--primary-color) to white */
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--spacing-sm);
    box-shadow: var(--shadow-sm);
}

    .logo .chat-logo {
        width: 20px;
        height: 20px;
        object-fit: contain;
        filter: none; /* Remove the white filter - shows original colors */
        /* OR if you want to force it to be black: */
        /* filter: brightness(0); */
    }

.branding h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

/* Search */
.search-wrapper {
    padding: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
}

.search-input-container {
    background-color: var(--bg-color);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    height: 34px;
    transition: all var(--transition-speed) ease;
    border: 1px solid var(--border-color);
}

    .search-input-container:focus-within {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px var(--primary-light);
    }

.search-icon {
    color: var(--text-secondary);
    margin-right: var(--spacing-sm);
    font-size: 14px;
}

.search-input-container input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 14px;
    color: var(--text-primary);
}

    .search-input-container input::placeholder {
        color: var(--text-secondary);
    }

.search-clear {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

.search-input-container input:not(:placeholder-shown) + .search-clear {
    opacity: 1;
}

/* Tabs */
.sidebar-tabs {
    display: flex;
    padding: 0 var(--spacing-md);
    margin: 0;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: var(--spacing-sm) 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
    text-align: center;
}

    .tab-btn:hover {
        color: var(--text-primary);
    }

    .tab-btn.active {
        color: var(--primary-color);
        border-bottom-color: var(--primary-color);
    }

/* Tab content */


.tab-content-teamchat {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-pane-teamchat {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: none;
}

    .tab-pane-teamchat.active {
        display: block;
    }

/* Conversation List */
.conversation-list {
    padding: 2px 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

    .conversation-list::-webkit-scrollbar {
        width: 4px;
    }

    .conversation-list::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }

.conversation-item {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-radius: var(--radius-md);
    margin: 0 var(--spacing-xs);
    margin-bottom: 2px;
    transition: all var(--transition-speed) ease;
    border-left: 3px solid transparent;
}

    .conversation-item:hover {
        background-color: var(--surface-hover);
    }

    .conversation-item.active {
        background-color: var(--primary-light);
        border-left-color: var(--primary-color);
    }

    .conversation-item.unread {
        background-color: rgba(37, 99, 235, 0.05);
        font-weight: 500;
    }

.conversation-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: var(--spacing-md);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.avatar-online-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--active-indicator);
    border: 2px solid var(--surface-color);
    border-radius: 50%;
    position: absolute;
    bottom: -2px;
    right: -2px;
    box-shadow: var(--shadow-sm);
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3px;
}

.conversation-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.conversation-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.conversation-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.conversation-item.unread .conversation-preview {
    color: var(--text-primary);
    font-weight: 500;
}

.conversation-status {
    margin-right: 4px;
    font-size: 12px;
}

.unread-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--unread-badge);
    color: white;
    border-radius: var(--radius-full);
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 600;
    padding: 0 var(--spacing-xs);
    margin-left: var(--spacing-sm);
    box-shadow: var(--shadow-sm);
}

/* No Results */
.no-results {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
    text-align: center;
    height: 200px;
}

    .no-results i {
        font-size: 32px;
        margin-bottom: var(--spacing-md);
        opacity: 0.5;
    }

/* Chat Area */
#chatView, .chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    overflow: hidden;
    position: relative;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: var(--bg-color);
    padding: var(--spacing-xl);
}

.welcome-content {
    max-width: 320px;
    animation: fadeIn 0.5s ease;
}

.welcome-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    box-shadow: var(--shadow-md);
}

    .welcome-icon i {
        font-size: 28px;
    }

.welcome-content h2 {
    margin-bottom: 10px;
    font-size: 20px;
    color: var(--text-primary);
}

.welcome-content p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.welcome-actions {
    display: flex;
    justify-content: center;
}

/* Chat Header */
.chat-header {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.chat-info {
    display: flex;
    align-items: center;
}

.back-button {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    margin-right: var(--spacing-sm);
    padding: var(--spacing-sm);
    cursor: pointer;
    font-size: 16px;
    border-radius: var(--radius-full);
}

    .back-button:hover {
        background-color: var(--surface-hover);
        color: var(--text-primary);
    }

.toggle-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    margin-right: var(--spacing-sm);
    padding: var(--spacing-sm);
    cursor: pointer;
    font-size: 16px;
    border-radius: var(--radius-full);
    display: none;
}

    .toggle-sidebar-btn:hover {
        background-color: var(--surface-hover);
        color: var(--text-primary);
    }

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

.chat-details {
    min-width: 0;
}

    .chat-details h4 {
        font-size: 16px;
        font-weight: 600;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--text-primary);
    }

.chat-status {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

    .chat-status.online::before {
        content: '';
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: var(--active-indicator);
        margin-right: var(--spacing-xs);
    }

.chat-actions {
    display: flex;
    align-items: center;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: none;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    margin-left: var(--spacing-xs);
}

    .btn-icon:hover {
        background-color: var(--surface-hover);
        color: var(--text-primary);
    }

    .btn-icon:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }

/* Search In Chat */
.search-chat-bar {
    display: none;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    animation: slideDown 0.3s ease;
}

    .search-chat-bar .search-input-container {
        background-color: var(--bg-color);
    }

.search-nav {
    display: flex;
    align-items: center;
    margin-left: var(--spacing-sm);
}

    .search-nav .btn-icon {
        width: 28px;
        height: 28px;
        margin: 0 var(--spacing-xxs);
    }

        .search-nav .btn-icon:disabled {
            color: var(--text-muted);
            background: none;
            cursor: default;
        }

#searchResultCount {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 var(--spacing-xs);
}

/* Message Container */
.message-container {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    position: relative;
    background-color: var(--bg-color);
    background-image: radial-gradient(var(--divider-color) 1px, transparent 1px), radial-gradient(var(--divider-color) 1px, var(--bg-color) 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

    .message-container::-webkit-scrollbar {
        width: 4px;
    }

    .message-container::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }

/* Loading Messages */
.loading-messages {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin-bottom: var(--spacing-md);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Message List */
.message-list {
    display: flex;
    flex-direction: column;
    padding-bottom: var(--spacing-md);
}

/* Empty Conversation */
.empty-conversation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    padding: var(--spacing-lg);
    margin: auto;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    width: 64px;
    height: 64px;
    background-color: var(--primary-light);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
    font-size: 24px;
}

.empty-conversation h3 {
    margin-bottom: var(--spacing-xs);
    font-size: 18px;
    color: var(--text-primary);
}

.empty-conversation p {
    color: var(--text-secondary);
}

/* Message Bubbles */
.message-wrapper {
    display: flex;
    margin-bottom: 8px;
    padding: var(--spacing-xs);
    border-radius: var(--radius-md);
    animation: fadeIn 0.3s ease;
}

    .message-wrapper.highlighted {
        background-color: rgba(245, 158, 11, 0.1);
    }

    .message-wrapper.outgoing {
        justify-content: flex-end;
    }

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background-color: var(--accent-color);
    margin-right: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 14px;
    flex-shrink: 0;
    align-self: flex-end;
    box-shadow: var(--shadow-sm);
}

.message-wrapper.outgoing .message-avatar {
    display: none;
}

.message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
}

.message-bubble {
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    position: relative;
    word-break: break-word;
    box-shadow: var(--shadow-sm);
    font-size: 13px;
}

.message-wrapper.incoming .message-bubble {
    background-color: var(--message-received-bg);
    color: var(--message-received-text);
    border-bottom-left-radius: var(--radius-sm);
}

.message-wrapper.outgoing .message-bubble {
    background-color: var(--message-sent-bg);
    color: var(--message-sent-text);
    border-bottom-right-radius: var(--radius-sm);
}

.message-meta {
    display: flex;
    align-items: center;
    margin-top: 4px;
    font-size: 11px;
}

.message-wrapper.incoming .message-meta {
    color: var(--text-secondary);
}

.message-wrapper.outgoing .message-meta {
    color: rgba(255, 255, 255, 0.7);
    justify-content: flex-end;
}

.message-time {
    margin-right: var(--spacing-xs);
}

.message-status {
    display: flex;
    align-items: center;
}

    .message-status .icon {
        font-size: 12px;
        margin-left: 2px;
    }

    .message-status .status-text {
        margin-left: 4px;
    }

.message-sender {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 13px;
    color: var(--primary-color);
}

.message-wrapper.outgoing .message-sender {
    display: none;
}

/* Attachments */
.message-attachment {
    margin-top: var(--spacing-xs);
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.message-wrapper.outgoing .message-attachment {
    background-color: rgba(255, 255, 255, 0.1);
}

.attachment-preview {
    max-width: 220px;
    max-height: 160px;
    object-fit: contain;
    display: block;
    cursor: pointer;
}

.attachment-file {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm);
}

.attachment-icon {
    margin-right: var(--spacing-sm);
    font-size: 18px;
    color: var(--primary-color);
}

.message-wrapper.outgoing .attachment-icon {
    color: white;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.message-wrapper.outgoing .attachment-meta {
    color: rgba(255, 255, 255, 0.7);
}

/* System Message */
.system-message {
    display: flex;
    justify-content: center;
    margin: 8px 0;
    color: var(--text-secondary);
    font-size: 11px;
}

.system-message-content {
    background-color: rgba(100, 116, 139, 0.1);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-full);
}

/* Timestamp Divider */
.timestamp-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: var(--spacing-md) 0;
}

.divider-line {
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

.divider-text {
    margin: 0 var(--spacing-md);
    font-size: 11px;
    color: var(--text-secondary);
    background-color: var(--bg-color);
    padding: 0 var(--spacing-xs);
    font-weight: 500;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: flex-end;
    margin: var(--spacing-md) 0;
}

.typing-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background-color: var(--accent-color);
    margin-right: var(--spacing-sm);
    opacity: 0.7;
}

.typing-content {
    background-color: var(--message-received-bg);
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 75%;
    display: flex;
    align-items: center;
}

.typing-dots {
    display: inline-flex;
    align-items: center;
    margin-left: var(--spacing-xs);
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background-color: var(--typing-indicator);
    margin: 0 1px;
    opacity: 0.7;
    animation: dot-pulse 1.5s infinite;
}

    .dot:nth-child(2) {
        animation-delay: 0.2s;
    }

    .dot:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes dot-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Scroll to Bottom Button */
.scroll-to-bottom {
    position: absolute;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 5;
}

#scrollBottomBtn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background-color: var(--surface-color);
    color: var(--primary-color);
    border: none;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

    #scrollBottomBtn:hover {
        background-color: var(--primary-color);
        color: white;
        transform: translateY(-2px);
    }

/* Message Input Area */
.message-input-area {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 8px;
    z-index: 10;
    flex: 0 0 auto;
}

.message-input-container {
    display: flex;
    align-items: flex-end;
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed) ease;
    box-shadow: var(--shadow-sm);
}

    .message-input-container:focus-within {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px var(--primary-light);
    }

.attachment-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: none;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    margin-right: var(--spacing-xs);
}

    .attachment-btn:hover {
        background-color: var(--surface-hover);
        color: var(--primary-color);
    }

.message-input-wrapper {
    flex: 1;
    margin: 0 var(--spacing-sm);
}

#messageInput {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    max-height: 100px;
    padding: 6px 0;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

    #messageInput:focus {
        outline: none;
    }

.send-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background-color: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

    .send-btn:disabled {
        background-color: var(--text-muted);
        cursor: default;
    }

    .send-btn:not(:disabled):hover {
        background-color: var(--primary-hover);
        transform: scale(1.05);
    }

/* Group Members List */
.group-members-list {
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-xs);
    background-color: var(--surface-color);
}

.member-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-speed) ease;
}

    .member-item:hover {
        background-color: var(--surface-hover);
    }

    .member-item:last-child {
        border-bottom: none;
    }

.member-checkbox {
    margin-right: var(--spacing-sm);
}

.member-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--spacing-sm);
    font-size: 12px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.member-name {
    font-size: 13px;
    font-weight: 500;
}

/* User Selection List */
.user-selection-list {
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: var(--spacing-sm);
}

.user-select-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-speed) ease;
    margin-bottom: var(--spacing-xs);
}

    .user-select-item:hover {
        background-color: var(--surface-hover);
    }

.user-select-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--spacing-md);
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

.user-select-info {
    flex: 1;
}

.user-select-name {
    font-weight: 500;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.user-select-status {
    font-size: 13px;
    color: var(--text-secondary);
}

    .user-select-status.online {
        color: var(--success-color);
    }

/* Context Menu */
.context-menu {
    position: absolute;
    width: 180px;
    background-color: var(--surface-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1010;
    display: none;
    overflow: hidden;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.2s ease;
}

.context-menu-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.context-menu-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color var(--transition-speed) ease;
    font-size: 13px;
}

    .context-menu-item:hover {
        background-color: var(--surface-hover);
    }

    .context-menu-item i {
        margin-right: var(--spacing-sm);
        font-size: 14px;
        width: 16px;
        text-align: center;
        color: var(--primary-color);
    }

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    display: inline-flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

    .btn-primary i {
        margin-right: var(--spacing-sm);
    }

    .btn-primary:hover {
        background-color: var(--primary-hover);
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }

.btn-secondary {
    background-color: var(--surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

    .btn-secondary:hover {
        background-color: var(--bg-color);
    }

/* Modal Styles */
.modal-content {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-lg);
}

.modal-body {
    padding: var(--spacing-md);
    background-color: var(--bg-color);
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-footer {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 10px var(--spacing-md);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

    .form-group label {
        display: block;
        margin-bottom: var(--spacing-xs);
        font-weight: 500;
        color: var(--text-primary);
    }

.form-control {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--surface-color);
    transition: all var(--transition-speed) ease;
    font-size: 14px;
}

    .form-control:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px var(--primary-light);
    }

/* Toast Notification Styles */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    background-color: var(--surface-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    max-width: 280px;
    border-left: 4px solid var(--primary-color);
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
    overflow: hidden;
    position: relative;
}

    .toast.success {
        border-left-color: var(--success-color);
    }

    .toast.warning {
        border-left-color: var(--warning-color);
    }

    .toast.error {
        border-left-color: var(--danger-color);
    }

    .toast.info {
        border-left-color: var(--info-color);
    }

.toast-icon {
    margin-right: var(--spacing-sm);
    font-size: 16px;
    color: var(--primary-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 12px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    margin-left: var(--spacing-sm);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.05);
}

.toast-progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    width: 100%;
    animation: progressShrink 5s linear forwards;
}

.toast.success .toast-progress-bar {
    background-color: var(--success-color);
}

.toast.warning .toast-progress-bar {
    background-color: var(--warning-color);
}

.toast.error .toast-progress-bar {
    background-color: var(--danger-color);
}

.toast.info .toast-progress-bar {
    background-color: var(--info-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: translateX(10%);
    }
}

@keyframes progressShrink {
    from {
        width: 100%;
    }

    to {
        width: 0;
    }
}

/* Responsive Design - Fixed for Mobile */
@media (max-width: 992px) {
    .atapic-chat-wrapper {
        width: 85vw;
        height: 80vh;
    }

    .sidebar {
        width: 230px;
    }
}

@media (max-width: 768px) {
    .atapic-chat-wrapper {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }

    .team-chat-wrapper {
        position: fixed;
        bottom: 0;
        right: 0;
    }

    .sidebar {
        width: 100%;
        height: 100%;
        position: absolute;
        left: 0;
        top: 0;
        z-index: 30;
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

        .sidebar.hidden {
            transform: translateX(-100%);
        }

    .toggle-sidebar-btn {
        display: flex;
    }

    .back-button {
        display: block;
    }

    .chat-header {
        padding: 0 var(--spacing-sm);
    }

    .message-bubble {
        max-width: 85%;
    }

    .message-input-area {
        padding: 8px;
    }

    /* For better touch targets on mobile */
    .btn-icon, .send-btn, .attachment-btn {
        min-width: 36px;
        min-height: 36px;
    }
}

@media (max-width: 480px) {
    .message-content {
        max-width: 85%;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .welcome-icon {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }

    .welcome-content h2 {
        font-size: 18px;
    }

    .chat-avatar {
        width: 28px;
        height: 28px;
    }

    /* Make modals more compact on small screens */
    .modal-dialog {
        margin: 5px;
        max-width: calc(100% - 10px);
    }

    .modal-body {
        padding: 12px;
    }

    .modal-footer, .modal-header {
        padding: 10px;
    }
}

/* Utilities */
.hidden {
    display: none !important;
}
/* Call overlay */
.call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
}

.call-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.video-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
}

    .video-wrapper.local {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 280px;
        height: 158px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .video-wrapper video {
        width: 100%;
        height: 100%;
        object-fit: cover;
       /* Mirror for front camera */
    }

@media (max-width: 768px) {
    .video-wrapper.local {
        width: 120px;
        height: 160px;
        top: 10px;
        right: 10px;
    }
}

.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

.participant-name {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: #2d3748;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

    .control-btn:hover {
        background: #4a5568;
    }

    .control-btn.danger {
        background: #e53e3e;
    }

        .control-btn.danger:hover {
            background: #c53030;
        }

    .control-btn.active {
        background: #4299e1;
    }

    .control-btn.disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* Incoming call dialog */
.incoming-call-info {
    text-align: center;
    padding: 20px 0;
}

.caller-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #4a5568;
    color: white;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
}

.caller-name {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 10px;
}

.call-type-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 15px;
    background: #2d3748;
    color: white;
    font-size: 14px;
}

/* Call buttons in chat header */
.chat-actions .btn-icon {
    position: relative;
}

#startAudioCallBtn .fa-phone {
    transform: rotate(90deg);
}

/* Responsive design */
@media (min-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    }
}

/* Dark theme support */
.dark-theme .call-overlay {
    background: rgba(0, 0, 0, 0.95);
}

.dark-theme .video-wrapper {
    background: #000;
}

.dark-theme .control-btn {
    background: #374151;
}

    .dark-theme .control-btn:hover {
        background: #4b5563;
    }

.dark-theme .call-type-badge {
    background: #374151;
}
/* Call buttons in chat header */
#startAudioCallBtn,
#startVideoCallBtn {
    display: inline-flex; /* Changed from 'none' to 'inline-flex' */
    margin-left: 4px;
}

/* Only show call buttons in direct chats */
.chat-area[data-chat-type="direct"] #startAudioCallBtn,
.chat-area[data-chat-type="direct"] #startVideoCallBtn {
    display: inline-flex;
}

#startAudioCallBtn .fa-phone {
    transform: rotate(90deg);
}

.chat-actions {
    display: flex;
    gap: 8px;
}

    .chat-actions .btn-icon {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background-color: transparent;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        transition: all 0.2s ease;
    }

        .chat-actions .btn-icon:hover {
            background-color: var(--surface-hover);
            color: var(--primary-color);
        }

/* ───────────────────────────────────────────────
   Call overlay tweaks  (21-May-2025)
   ───────────────────────────────────────────── */
.call-overlay {
    /* centre & cap size instead of edge-to-edge */
    display: none; /* shown by JS                     */
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 9999;
    /* new ↓ */
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.call-container {
    /* max width / height keep buttons visible */
    width: 100%;
    max-width: 1050px; /* shrink on big screens           */
    height: 100%;
    max-height: 680px;
    background: #000; /* subtle frame behind video       */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* video layout – one big, one PiP */
.video-grid {
    flex: 1;
    position: relative;
}

.video-wrapper.remote {
    /* remote (or shared screen) gets the stage */
    position: absolute;
    inset: 0;
}

.video-wrapper.local {
    width: 240px;
    height: 135px;
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,.45);
    border: 2px solid rgba(255,255,255,.2);
    border-radius: 8px;
}

/* keep buttons pinned bottom-centre regardless of video size */
.call-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    gap: 18px;
}

/* When *you* share your screen we add .sharing to call-overlay via JS
   → remote still fills window, your PiP stays.  If the other party shares
   you’ll automatically see it here because it’s just video frames. */
.call-overlay.sharing .video-wrapper.remote video {
    object-fit: contain; /* entire screen visible */
}

/* mobile: make PiP smaller and stack buttons */
@media (max-width:640px) {
    .video-wrapper.local {
        width: 110px;
        height: 160px;
    }

    .call-controls {
        flex-wrap: wrap;
        gap: 12px;
    }
}
#localVideo,
#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: contain; /* show the whole frame, no crop */
}

/* only cam-preview should be mirrored */
video.mirror {
    transform: scaleX(-1); /* NOT  -1,-1  and NOT rotate(180deg) */
}

#typingIndicator {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 14px;
    color: #666;
    /* Remove all the fixed positioning */
    position: relative;
    z-index: 1;
}

.typing-text {
    font-style: italic;
}

/* Dark theme support if needed */
.dark-theme #typingIndicator {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

