/* CSS Variables */
:root {
    --primary-color: #000;
    --secondary-color: #f5f5f5;
    --accent-color: #1a1a1a;
    --border-color: #e5e5e5;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --white: #fff;
    --chat-incoming-bg: #fff;
    --chat-outgoing-bg: #1a1a1a;
    --sidebar-width: 60px;
    --inbox-width: 200px;
    --chat-list-width: 350px;
    --header-height: 60px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--white);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* App Container */
#app {
    display: grid;
    grid-template-columns: var(--sidebar-width) var(--inbox-width) var(--chat-list-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    height: 100vh;
    position: relative;
}

/* Top Header */
.top-header {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Burger Menu */
.burger-menu {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.burger-menu:hover {
    background: var(--secondary-color);
}

.burger-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Burger to X animation */
.burger-menu.active .burger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.burger-menu.active .burger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.burger-menu.active .burger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Inbox Toggle Button */
.inbox-toggle-btn {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.inbox-toggle-btn:hover {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.inbox-toggle-btn i {
    font-size: 20px;
}

/* Header Logo */
.header-logo {
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -1px;
}

/* Language Selector */
.language-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-select {
    min-width: 140px;
}

.language-selector-wrapper .settings-icon {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    cursor: pointer;
}

.language-selector-wrapper .settings-icon:hover {
    color: var(--text-primary);
}

/* Select2 Language Custom Styling */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-flag {
    font-size: 16px;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.language-selector .flag {
    font-size: 16px;
}

.language-selector .settings-icon {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

/* Social Filter Buttons */
.filter-btn i {
    font-size: 18px;
    flex-shrink: 0;
}

.filter-btn.whatsapp-btn:hover,
.filter-btn.instagram-btn:hover,
.filter-btn.facebook-btn:hover,
.filter-btn.telegram-btn:hover {
    background: var(--secondary-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.user-profile:hover {
    background: var(--secondary-color);
}

.profile-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.user-profile.active .profile-chevron {
    transform: rotate(180deg);
}

/* Profile Dropdown */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-profile.active .profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s ease;
}

.profile-dropdown .dropdown-item:hover {
    background: var(--secondary-color);
}

.profile-dropdown .dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.profile-dropdown .dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.profile-dropdown .dropdown-item i {
    font-size: 18px;
    color: var(--text-secondary);
}

.profile-dropdown .dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.profile-dropdown .logout-item {
    color: #dc3545;
}

.profile-dropdown .logout-item i {
    color: #dc3545;
}

.profile-dropdown .logout-item:hover {
    background: #fff5f5;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar i {
    font-size: 20px;
    color: var(--text-secondary);
}

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

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-email {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Sidebar Icons */
.sidebar-icons {
    grid-row: 2;
    background: var(--white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

.sidebar-logo {
    margin-bottom: 30px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--text-primary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-color);
    color: var(--white);
}

.nav-item i {
    font-size: 22px;
}

/* Hide nav text on desktop */
.nav-item .nav-text {
    display: none;
}

/* Sidebar Tooltip */
.nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-color);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    pointer-events: none;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--accent-color);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.nav-item:hover::after,
.nav-item:hover::before {
    opacity: 1;
    visibility: visible;
}

[navigate] {
  cursor: pointer;
  user-select: none;        /* metin seçimini önlerse daha 'buton' hissi verir (isteğe bağlı) */
  -webkit-tap-highlight-color: transparent; /* mobilde dokunma vurgusunu yumuşatır */
}

/* Sidebar Bottom - Logout */
.sidebar-bottom {
    margin-top: auto;
    padding: 0 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.sidebar-bottom .logout-btn {
    color: var(--text-secondary);
}

.sidebar-bottom .logout-btn:hover {
    background: #ffebee;
    color: #dc3545;
}

.sidebar-toggle {
    padding: 8px 0;
}

.toggle-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn i {
    font-size: 20px;
}

/* Inbox Sidebar */
.sidebar-inbox {
    grid-row: 2;
    background: var(--white);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
}

.inbox-header {
    padding: 0 20px;
    margin-bottom: 20px;
}

.inbox-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.inbox-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.inbox-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.inbox-nav-item:hover {
    background: var(--secondary-color);
}

.inbox-nav-item.active {
    background: var(--accent-color);
    color: var(--white);
}

.inbox-nav-item i {
    font-size: 18px;
}

/* Chat List Panel */
.chat-list-panel {
    grid-row: 2;
    background: var(--white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-list-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.chat-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom-color: var(--text-primary);
}

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

.filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--white);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-color);
    color: var(--white);
    border-color: var(--accent-color);
}

.filter-btn.active:hover {
    background: var(--white);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* Social Filter Buttons - Default colors */
.filter-btn.whatsapp-btn i {
    color: #25D366;
}

.filter-btn.instagram-btn i {
    color: #E4405F;
}

.filter-btn.facebook-btn i {
    color: #1877F2;
}

.filter-btn.telegram-btn i {
    color: #0088cc;
}

/* Social Filter Buttons - Active state (white icon) */
.filter-btn.whatsapp-btn.active i,
.filter-btn.instagram-btn.active i,
.filter-btn.facebook-btn.active i,
.filter-btn.telegram-btn.active i {
    color: var(--white);
}

/* Social Filter Buttons - Active + Hover state (black icon) */
.filter-btn.whatsapp-btn.active:hover i,
.filter-btn.instagram-btn.active:hover i,
.filter-btn.facebook-btn.active:hover i,
.filter-btn.telegram-btn.active:hover i {
    color: var(--text-primary);
}

.filter-icon {
    font-size: 14px;
}

/* Chat List */
.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.chat-item:hover {
    background: var(--secondary-color);
}

.chat-item.active {
    background: #e3f2fd;
    border-left-color: #2196f3;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.chat-avatar i {
    font-size: 22px;
    color: var(--text-secondary);
}

.status-dot {
    position: absolute;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f44336;
    border: 2px solid var(--white);
}

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

.chat-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-name {
    font-weight: 600;
    font-size: 14px;
}

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

/* Chat Tags */
.chat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
    max-width: 100%;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.agent-tag {
    background: #e3f2fd;
    color: #1976d2;
}

.category-tag {
    background: #f3e5f5;
    color: #7b1fa2;
}

.category-tag.vip {
    background: #fff3e0;
    color: #e65100;
}

.chat-preview {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-preview i {
    font-size: 14px;
}

.check-icon {
    color: #2196f3;
}

.unread-badge {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: #2196f3;
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Main */
.chat-main {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    background: var(--white);
    overflow: hidden;
    position: relative;
}

/* Chat Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
}

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

.back-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn i {
    font-size: 20px;
}

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

.chat-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-user-avatar i {
    font-size: 22px;
    color: var(--text-secondary);
}

.chat-user-details h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.phone-number {
    font-size: 13px;
    color: var(--text-secondary);
}

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

#tagSelect {
    min-width: 80px;
}

#assignSelect {
    min-width: 120px;
}

#statusSelect {
    min-width: 90px;
}

/* Status Select Colors */
.status-open {
    color: #4caf50;
}

.status-closed {
    color: #f44336;
}

.status-snoozed {
    color: #ff9800;
}

.status-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--white);
    font-size: 13px;
    cursor: pointer;
}

.status-btn i {
    font-size: 16px;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    padding-bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fafafa;
}

.message {
    display: flex;
    max-width: 70%;
}

.message.incoming {
    align-self: flex-start;
}

.message.outgoing {
    align-self: flex-end;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 2px;
}

.message.incoming .message-content {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message.outgoing .message-content {
    background: var(--accent-color);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    white-space: nowrap;
}

.message-status {
    display: flex;
    align-items: center;
}

.message-status i {
    font-size: 16px;
    color: #4fc3f7;
}

/* Message Reactions */
.message-reaction {
    position: absolute;
    bottom: -12px;
    right: 8px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message.outgoing .message-reaction {
    left: 8px;
    right: auto;
}

/* Location Message */
.location-message {
    padding: 8px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
}

.location-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
}

.location-preview {
    display: flex;
    gap: 12px;
    align-items: center;
}

.location-map-placeholder {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.location-map-placeholder i {
    font-size: 28px;
    color: white;
}

.location-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.location-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.location-coords {
    font-size: 12px;
    color: var(--text-secondary);
}

.message.outgoing .location-title,
.message.outgoing .location-coords {
    color: var(--white);
}

.message.outgoing .location-coords {
    opacity: 0.8;
}

/* Contact Message */
.contact-message {
    padding: 8px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
}

.contact-card {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.contact-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.incoming .contact-avatar {
    background: var(--secondary-color);
}

.contact-avatar i {
    font-size: 24px;
}

.message.incoming .contact-avatar i {
    color: var(--text-secondary);
}

.message.outgoing .contact-avatar i {
    color: var(--white);
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-name {
    font-weight: 600;
    font-size: 14px;
}

.contact-phone {
    font-size: 13px;
    opacity: 0.8;
}

/* Image Message */
.image-message {
    padding: 6px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    max-width: 300px;
}

.image-container {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.message-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-image:hover {
    transform: scale(1.02);
}

.image-caption {
    margin: 8px 4px 4px 4px !important;
    font-size: 14px;
}

/* Video Message */
.video-message {
    padding: 6px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    max-width: 300px;
}

.video-container {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.video-thumbnail {
    position: relative;
    width: 100%;
    cursor: pointer;
}

.video-preview {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    min-height: 150px;
    max-height: 200px;
    background: #000;
}

.video-preview-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    min-height: 150px;
    max-height: 200px;
}

.message-video-thumb {
    width: 100%;
    height: auto;
    display: block;
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.video-play-btn:hover {
    background: rgba(0,0,0,0.8);
}

.video-play-btn i {
    font-size: 24px;
    color: white;
    margin-left: 3px;
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* Sticker Message */
.sticker-message {
    padding: 8px !important;
    background: transparent !important;
    border: none !important;
    flex-direction: column !important;
    align-items: center !important;
}

.message.incoming .sticker-message {
    background: transparent !important;
    border: none !important;
}

.sticker-container {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-emoji {
    font-size: 80px;
    line-height: 1;
}

.sticker-message .message-time {
    color: var(--text-secondary);
}

/* Voice Message Player */
.voice-message-content {
    min-width: 200px;
}

.voice-message-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.voice-play-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.message.incoming .voice-play-btn {
    background: var(--primary-color);
    color: var(--white);
}

.message.outgoing .voice-play-btn {
    background: rgba(255, 255, 255, 0.3);
    color: var(--white);
}

.voice-play-btn:hover {
    transform: scale(1.1);
}

.voice-play-btn i {
    font-size: 16px;
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.waveform-bar {
    width: 3px;
    background: currentColor;
    border-radius: 2px;
    opacity: 0.6;
}

.message.incoming .waveform-bar {
    background: var(--text-secondary);
}

.message.outgoing .waveform-bar {
    background: rgba(255, 255, 255, 0.7);
}

.waveform-bar:nth-child(1) { height: 8px; }
.waveform-bar:nth-child(2) { height: 16px; }
.waveform-bar:nth-child(3) { height: 12px; }
.waveform-bar:nth-child(4) { height: 20px; }
.waveform-bar:nth-child(5) { height: 14px; }
.waveform-bar:nth-child(6) { height: 18px; }
.waveform-bar:nth-child(7) { height: 10px; }
.waveform-bar:nth-child(8) { height: 6px; }

.voice-duration {
    font-size: 12px;
    opacity: 0.8;
    min-width: 32px;
}

.voice-audio {
    display: none;
}

/* Chat Input */
.chat-input-container {
    position: fixed;
    bottom: 0;
    right: 0;
    left: calc(var(--sidebar-width) + var(--inbox-width) + var(--chat-list-width));
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--white);
    z-index: 100;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--white);
}

.input-actions {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.action-btn:hover {
    color: var(--text-primary);
}

.action-btn i {
    font-size: 20px;
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 8px 0;
}

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

.send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    background: transparent;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover {
    background: var(--primary-color);
    color: var(--white);
}

.send-btn:hover i {
    color: var(--white);
}

.send-btn i {
    font-size: 18px;
}

/* Emoji Picker */
.emoji-picker {
    position: fixed;
    bottom: 80px;
    left: 16px;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
}

.emoji-picker.active {
    display: flex;
    animation: emojiSlideUp 0.2s ease forwards;
}

@keyframes emojiSlideUp {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.emoji-picker-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.emoji-search-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--secondary-color);
    border-radius: 8px;
}

.emoji-search-wrapper i {
    font-size: 18px;
    color: var(--text-secondary);
}

.emoji-search {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
}

.emoji-search::placeholder {
    color: var(--text-secondary);
}

.emoji-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.emoji-close-btn:hover {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.emoji-close-btn i {
    font-size: 18px;
}

.emoji-categories {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.emoji-categories::-webkit-scrollbar {
    display: none;
}

.emoji-category-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.emoji-category-btn:hover {
    background: var(--secondary-color);
}

.emoji-category-btn.active {
    background: var(--primary-color);
    transform: scale(1.1);
}

.emoji-content {
    max-height: 280px;
    overflow-y: auto;
    padding: 12px;
}

.emoji-category-section {
    margin-bottom: 16px;
}

.emoji-category-section:last-child {
    margin-bottom: 0;
}

.emoji-category-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-left: 4px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji-item {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.emoji-item:hover {
    background: var(--secondary-color);
    transform: scale(1.2);
}

.emoji-item:active {
    transform: scale(0.95);
}

.emoji-no-results {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.emoji-no-results i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Voice Recording */
.voice-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-radius: 50%;
}

.voice-btn:hover {
    color: var(--primary-color);
    background: var(--secondary-color);
}

.voice-btn i {
    font-size: 20px;
}

.voice-recording-wrapper {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--secondary-color);
    border-radius: 12px;
    margin-top: 12px;
}

.voice-recording-wrapper.active {
    display: flex;
}

.chat-input-wrapper.recording {
    display: none;
}

.voice-cancel-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: #f44336;
    color: var(--white);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.voice-cancel-btn:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

.voice-cancel-btn i {
    font-size: 20px;
}

.voice-recording-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.recording-indicator {
    width: 12px;
    height: 12px;
    background: #f44336;
    border-radius: 50%;
    animation: pulse-recording 1s ease-in-out infinite;
}

@keyframes pulse-recording {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.recording-time {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.voice-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.voice-send-btn:hover {
    background: var(--accent-color);
    transform: scale(1.05);
}

.voice-send-btn i {
    font-size: 20px;
}

/* Select2 Customization */
.select2-container--bootstrap-5 .select2-selection {
    border-radius: 6px;
    min-height: 38px;
}

/* Responsive Styles */
@media (max-width: 1200px) {
    #app {
        grid-template-columns: var(--sidebar-width) var(--chat-list-width) 1fr;
    }
    
    .sidebar-inbox {
        display: none;
    }
}

@media (max-width: 992px) {
    #app {
        grid-template-columns: 1fr;
    }
    
    .sidebar-icons {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        width: 200px;
        z-index: 200;
        background: var(--white);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-direction: column;
        padding: 16px 0;
    }
    
    .sidebar-icons.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-icons .sidebar-nav {
        flex-direction: column;
        gap: 4px;
        padding: 0 12px;
    }
    
    .sidebar-icons .nav-item {
        width: 100%;
        height: auto;
        padding: 12px 16px;
        border-radius: 8px;
        justify-content: flex-start;
        gap: 12px;
    }
    
    .sidebar-icons .nav-item .nav-text {
        display: block;
        font-size: 14px;
        font-weight: 500;
    }
    
    .sidebar-icons .nav-item::after {
        display: none;
    }
    
    .sidebar-icons .sidebar-toggle {
        display: none;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    .burger-menu {
        display: flex;
    }
    
    .inbox-toggle-btn {
        display: flex;
    }
    
    .sidebar-inbox {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        width: var(--inbox-width);
        z-index: 200;
        background: var(--white);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar-inbox.mobile-open {
        display: flex;
        transform: translateX(0);
    }
    
    .inbox-overlay {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .inbox-overlay.active {
        display: block;
        opacity: 1;
    }
    
    .chat-list-panel {
        display: none;
    }
    
    .chat-list-panel.active {
        display: flex;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
    }
    
    .chat-main {
        grid-column: 1;
    }
    
    .chat-main.hidden {
        display: none;
    }
    
    .top-header {
        justify-content: space-between;
        padding: 0 16px;
    }
    
    .header-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .user-info {
        display: none;
    }
}

@media (max-width: 768px) {
    .chat-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .chat-header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    #assignSelect {
        min-width: 120px;
    }
    
    .chat-messages {
        padding: 16px;
        padding-bottom: 80px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .chat-input-container {
        left: 0;
        padding: 12px 16px;
    }
    
    .send-btn span {
        display: none;
    }
    
    .language-selector span:not(.flag) {
        display: none;
    }
    
    /* Tag Selector Mobile */
    .tag-dropdown {
        right: auto;
        left: 0;
    }
    
    /* Emoji Picker Mobile */
    .emoji-picker {
        left: 16px !important;
        right: 16px;
        width: auto;
        max-width: none;
        border-radius: 12px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
    
    .emoji-content {
        max-height: 220px;
    }
}

@media (max-width: 576px) {
    .chat-user-details h3 {
        font-size: 14px;
    }
    
    .phone-number {
        font-size: 12px;
    }
    
    .status-btn span {
        display: none;
    }
    
    .input-actions {
        gap: 0;
    }
    
    .action-btn {
        width: 32px;
        height: 32px;
    }
    
    /* Emoji Picker Small Mobile */
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .emoji-item {
        font-size: 20px;
    }
    
    .emoji-category-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .emoji-content {
        max-height: 200px;
        padding: 8px;
    }
}

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

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

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

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

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 8px 0;
    z-index: 100;
}

@media (max-width: 992px) {
    .mobile-nav {
        display: flex;
        justify-content: space-around;
    }
    
    .mobile-nav .nav-item {
        flex: 1;
        justify-content: center;
    }
    
    .chat-main {
        padding-bottom: 60px;
    }
}

/* Media Preview Modal */
.media-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.media-preview-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.modal-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-close i {
    font-size: 24px;
    color: white;
}

.modal-media-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    object-fit: contain;
}

.preview-video-container {
    position: relative;
    cursor: pointer;
    max-width: 90vw;
    max-height: 85vh;
}

.preview-video {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    background: #000;
}

.preview-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    gap: 12px;
}

.preview-play-overlay i {
    font-size: 64px;
    color: white;
}

.preview-play-overlay span {
    color: white;
    font-size: 14px;
}

/* Select2 Auto Width Fix */
.select2-container--bootstrap-5 {
    min-width: 100px;
}

.select2-container--bootstrap-5 .select2-selection--single {
    padding-right: 30px;
}

.language-selector-wrapper .select2-container,
.chat-header-right .select2-container {
    min-width: auto;
}

/* Select2 Focus Outline Remove */
.select2-container--bootstrap-5 .select2-selection:focus,
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--border-color) !important;
    box-shadow: none !important;
    outline: none !important;
}

.select2-container--bootstrap-5 .select2-selection--multiple:focus,
.select2-container--bootstrap-5.select2-container--focus .select2-selection--multiple {
    border-color: var(--border-color) !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Tag Selector - Custom Dropdown */
.tag-selector {
    position: relative;
}

.tag-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tag-trigger:hover {
    background: var(--secondary-color);
}

.tag-trigger i {
    font-size: 16px;
    color: var(--text-secondary);
}

.tag-trigger.has-tags {
    border-color: var(--accent-color);
}

.tag-trigger.has-tags i {
    color: var(--accent-color);
}

.tag-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    background: var(--accent-color);
    color: var(--white);
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.tag-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

.tag-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tag-dropdown-header {
    padding: 10px 12px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.tag-options {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tag-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.tag-option input[type="checkbox"] {
    display: none;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: var(--secondary-color);
    color: var(--text-primary);
    transition: all 0.15s ease;
    width: 100%;
    position: relative;
}

.tag-chip::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tag-color);
    margin-right: 8px;
    flex-shrink: 0;
}

.tag-option:hover .tag-chip {
    background: var(--border-color);
}

.tag-option input[type="checkbox"]:checked + .tag-chip {
    background: var(--accent-color);
    color: var(--white);
}

.tag-option input[type="checkbox"]:checked + .tag-chip::after {
    content: '✓';
    position: absolute;
    right: 10px;
    font-size: 12px;
}

/* Select2 Multiple Selection Styling */

.select2-container--bootstrap-5 .select2-selection--multiple {
    min-height: 28px;
    padding: 2px 6px;
    border-radius: 6px;
    border-color: var(--border-color);
    background: var(--white);
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 0px 6px;
    font-size: 11px;
    margin: 1px;
    line-height: 1.6;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--text-secondary);
    margin-right: 3px;
    font-size: 12px;
    line-height: 1;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: var(--text-primary);
    background: transparent;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-search__field {
    margin-top: 0;
    font-size: 11px;
    line-height: 20px;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-search__field::placeholder {
    font-size: 11px;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px;
}

/* Chat Header Tag Select - Compact */
.chat-header-right .tag-select + .select2-container {
    min-width: 100px;
    max-width: 200px;
}

.chat-header-right .select2-container--bootstrap-5 .select2-selection--multiple {
    min-height: 28px;
    padding: 2px 24px 2px 6px;
    position: relative;
}

.chat-header-right .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-right: 4px;
}

.chat-header-right .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered::-webkit-scrollbar {
    display: none;
}

.chat-header-right .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    padding: 1px 6px;
    font-size: 11px;
    line-height: 1.4;
    flex-shrink: 0;
}

.chat-header-right .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove {
    font-size: 11px;
    margin-right: 3px;
}

/* Chat Header Selects - Smaller */
.chat-header-right .select2-container--bootstrap-5 .select2-selection--single {
    min-height: 28px;
    padding: 2px 8px;
    font-size: 12px;
}

.chat-header-right .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    font-size: 12px;
    line-height: 22px;
    padding-left: 0;
}

.chat-header-right .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 26px;
}

.chat-header-right .select2-container {
    font-size: 12px;
}

/* Select2 Clear Button */
.chat-header-right .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__clear {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    padding: 0;
    margin: 0;
}

/* Select2 Dropdown Options Styling */
.select2-container--bootstrap-5 .select2-results__option {
    padding: 8px 10px;
    font-size: 12px;
}

.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: var(--secondary-color) !important;
    color: var(--text-primary) !important;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: var(--secondary-color);
    color: var(--text-primary);
}

.select2-container--bootstrap-5 .select2-results__option--highlighted.select2-results__option--selected {
    background-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    min-width: max-content !important;
}

.select2-container--bootstrap-5 .select2-results__option {
    white-space: nowrap;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
}

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

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Skeleton Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

/* Chat List Skeleton */
.chat-list-skeleton {
    display: none;
    flex-direction: column;
    padding: 8px;
}

.chat-list-skeleton.active {
    display: flex;
}

.chat-list.hidden {
    display: none;
}

.skeleton-chat-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    gap: 12px;
}

.skeleton-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skeleton-name {
    width: 100px;
    height: 14px;
}

.skeleton-time {
    width: 50px;
    height: 12px;
}

.skeleton-tags {
    display: flex;
    gap: 6px;
}

.skeleton-tag {
    width: 50px;
    height: 16px;
    border-radius: 8px;
}

.skeleton-preview {
    width: 80%;
    height: 12px;
}

/* Chat Messages Skeleton */
.chat-messages-skeleton {
    display: none;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
}

.chat-messages-skeleton.active {
    display: flex;
}

.chat-messages.hidden {
    display: none;
}

.skeleton-message {
    display: flex;
}

.skeleton-message.incoming {
    justify-content: flex-start;
}

.skeleton-message.outgoing {
    justify-content: flex-end;
}

.skeleton-message-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 65%;
}

.skeleton-message-bubble {
    height: 40px;
    border-radius: 12px;
}

.skeleton-message.incoming .skeleton-message-bubble {
    border-bottom-left-radius: 4px;
}

.skeleton-message.outgoing .skeleton-message-bubble {
    border-bottom-right-radius: 4px;
}

.skeleton-message-text-short {
    width: 120px;
}

.skeleton-message-text-medium {
    width: 200px;
}

.skeleton-message-text-long {
    width: 280px;
}

.skeleton-message-time {
    width: 40px;
    height: 10px;
    align-self: flex-end;
}
