/* assets/css/messenger.css — мессенджер, чат, общий чат, поддержка, AI-ассистент */

/* ============================================================
   ОБЩИЙ ЧАТ
   ============================================================ */
.common-chat-container {
    overflow: hidden;
    height: 580px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.common-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.common-message {
    display: flex;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    min-width: 0;
}

.common-message:hover {
    background: rgba(255, 255, 255, 0.02);
}

.common-message.deleted {
    opacity: 0.5;
}

.common-message-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 25px var(--primary-glow);
    flex-shrink: 0;
}

.common-message-avatar.admin-avatar-chat {
    background: linear-gradient(135deg, var(--danger), #dc2626);
}

.common-message-content {
    flex: 1;
    min-width: 0;
}

.common-message-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.common-message-author {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary-light);
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.admin-author-chat {
    color: var(--danger) !important;
}

.common-message-group {
    font-size: 9px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 12px;
    border-radius: var(--radius-full);
}

.common-message-time {
    font-size: 9px;
    color: var(--text-muted);
}

.common-message-text {
    font-size: 14px;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
    max-width: 100%;
    min-width: 0;
}

.common-message-text em {
    color: var(--text-muted);
    font-style: italic;
}

.common-message-input {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.common-message-input textarea {
    flex: 1;
    padding: 14px 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    resize: vertical;
    font-family: var(--font);
    font-size: 13px;
    min-height: 46px;
    max-height: 120px;
    transition: all 0.08s ease;
}

.common-message-input textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 5px var(--primary-glow);
}

.common-chat-image-btn,
.common-chat-file-btn {
    width: 46px;
    height: 46px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.08s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.common-chat-image-btn:hover,
.common-chat-file-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 0 25px var(--primary-glow);
}

.send-btn {
    padding: 0 36px;
    height: 46px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-full);
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.08s ease;
    box-shadow: 0 4px 40px var(--primary-glow);
    flex-shrink: 0;
}

.send-btn:hover {
    box-shadow: 0 8px 60px var(--primary-glow-strong);
}

.send-btn:active {
    transform: scale(0.96);
}

.char-counter {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    padding: 0 10px;
    flex-shrink: 0;
}

.message-date-separator {
    text-align: center;
    margin: 8px 0;
}

.message-date-separator span {
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 20px;
    border-radius: var(--radius-full);
    font-size: 10px;
    color: var(--text-muted);
}

.message-delete-btn {
    background: var(--danger-dim);
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    margin-left: 8px;
    color: var(--danger);
    font-size: 9px;
    cursor: pointer;
    transition: all 0.08s ease;
    opacity: 0;
}

.common-message:hover .message-delete-btn {
    opacity: 1;
}

.message-delete-btn:hover {
    background: var(--danger);
    color: #ffffff;
}

.common-message-image-container {
    max-width: 260px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 6px 0;
    cursor: pointer;
}

.common-message-image {
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: cover;
}

.message-file-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    margin: 6px 0;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    max-width: 100%;
}

.message-file-container:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--primary);
}

.message-file-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.message-file-name {
    font-size: 12px;
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message-file-size {
    font-size: 10px;
    color: var(--text-muted);
}

.message-file-download {
    color: var(--primary-light);
}

/* ============================================================
   ВИДЕО В СООБЩЕНИЯХ
   ============================================================ */
.message-video-container {
    max-width: 340px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 6px 0;
    background: #000;
    border: 1px solid var(--glass-border);
}

.message-video {
    width: 100%;
    height: auto;
    max-height: 240px;
    display: block;
    background: #000;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.message-video-meta {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-secondary);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--glass-border);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.message-video-meta i {
    color: var(--primary-light);
    font-size: 12px;
}

@media (max-width: 600px) {
    .message-video-container {
        max-width: 260px;
    }
    .message-video {
        max-height: 180px;
    }
}

body.light-theme .message-video-meta {
    background: rgba(0, 0, 0, 0.05);
}

/* ============================================================
   МЕССЕНДЖЕР
   ============================================================ */
.messenger-layout {
    display: flex;
    gap: 0;
    overflow: hidden;
    height: 640px;
    max-height: 80vh;
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.messenger-sidebar {
    width: 320px;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 10;
}

.messenger-sidebar.hidden-sidebar {
    transform: translateX(-100%);
}

.messenger-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.messenger-overlay.active {
    display: block;
}

.messenger-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.08);
    min-width: 0;
}

#messengerEmptyState {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}

#messengerEmptyState i {
    font-size: 52px;
    margin-bottom: 16px;
    opacity: 0.15;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

#messengerEmptyState small {
    font-size: 12px;
    opacity: 0.5;
}

#messengerChatArea {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

#messengerChatArea.active {
    display: flex !important;
}

.messenger-header {
    padding: 16px 22px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
    min-height: 64px;
    width: 100%;
}

.messenger-header .back-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    padding: 6px 10px;
}

.messenger-header .back-btn:hover {
    color: var(--text-primary);
}

.messenger-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.messenger-header-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 25px var(--primary-glow);
}

.messenger-header-avatar.admin-chat-avatar {
    background: linear-gradient(135deg, var(--danger), #dc2626);
}

.messenger-header-details {
    flex: 1;
    min-width: 0;
}

.messenger-header-name {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messenger-header-status {
    font-size: 11px;
    color: var(--text-muted);
}

.messenger-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.messenger-action-btn {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    padding: 8px 18px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.08s ease;
}

.messenger-action-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 25px var(--primary-glow);
}

.messenger-action-btn.danger {
    background: var(--danger-dim);
    border-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.messenger-action-btn.danger:hover {
    background: var(--danger);
    color: #ffffff;
}

.messenger-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.06);
    min-height: 120px;
}

.message-item {
    display: flex;
    max-width: 80%;
    min-width: 0;
}

.message-item.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-item.other {
    align-self: flex-start;
}

.message-bubble-messenger {
    padding: 12px 18px;
    border-radius: var(--radius-lg);
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
    font-size: 13px;
    min-width: 0;
}

.message-item.own .message-bubble-messenger {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark), var(--secondary));
    background-size: 200% 200%;
    border-bottom-right-radius: 4px;
    color: #ffffff;
}

.message-item.other .message-bubble-messenger {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

.message-author {
    font-size: 10px;
    margin-bottom: 4px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}

.message-author-name {
    font-weight: 600;
    color: var(--primary-light);
    font-size: 11px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message-time {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 4px;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.message-actions {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
    opacity: 0;
}

.message-item:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    background: rgba(0, 0, 0, 0.4);
    border: none;
    border-radius: 6px;
    padding: 3px 8px;
    color: var(--text-muted);
    font-size: 9px;
    cursor: pointer;
    transition: all 0.08s ease;
}

.message-action-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

.message-action-btn.delete:hover {
    background: var(--danger);
}

.message-system {
    text-align: center;
    margin: 8px 0;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.message-system span {
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 16px;
    border-radius: var(--radius-full);
    font-size: 11px;
    color: var(--text-muted);
    display: inline-block;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
}

.edited-badge {
    font-size: 9px;
    color: var(--text-muted);
    margin-left: 4px;
}

.messenger-input-area {
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.messenger-input {
    flex: 1;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    resize: none;
    font-family: var(--font);
    font-size: 13px;
    min-height: 44px;
    max-height: 120px;
    transition: all 0.08s ease;
}

.messenger-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 5px var(--primary-glow);
}

.messenger-image-btn,
.messenger-file-btn,
.messenger-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.08s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.messenger-image-btn:hover,
.messenger-file-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 0 25px var(--primary-glow);
}

.messenger-send-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 40px var(--primary-glow);
}

.messenger-send-btn:hover {
    box-shadow: 0 6px 50px var(--primary-glow-strong);
}

.messenger-search {
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.messenger-search-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.08s ease;
}

.messenger-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 5px var(--primary-glow);
}

.messenger-tabs {
    display: flex;
    padding: 10px 14px;
    gap: 8px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.messenger-tab {
    padding: 8px 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    flex: 1;
    text-align: center;
    border-radius: var(--radius-full);
    transition: all 0.08s ease;
}

.messenger-tab:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.messenger-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
}

.messenger-chats-list,
.people-search-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-item-messenger {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.08s ease;
    border: 1px solid transparent;
    position: relative;
    user-select: none;
    min-width: 0;
}

.chat-item-messenger:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--primary);
}

.chat-item-messenger.active {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
}

.chat-item-messenger:active {
    transform: scale(0.97);
}

.chat-avatar-messenger {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 0 25px var(--primary-glow);
}

.chat-avatar-messenger.group {
    background: linear-gradient(135deg, var(--success), #059669);
}

.chat-avatar-messenger.admin-chat-avatar {
    background: linear-gradient(135deg, var(--danger), #dc2626);
}

.chat-info-messenger {
    flex: 1;
    min-width: 0;
}

.chat-name-messenger {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}

.chat-group-badge {
    font-size: 8px;
    background: var(--success-dim);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    color: var(--success);
}

.chat-last-message-messenger {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time-messenger {
    font-size: 9px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.chat-item-messenger .unread-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary);
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 0 25px var(--primary-glow);
}

.person-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.08s ease;
    border: 1px solid transparent;
    user-select: none;
}

.person-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--primary);
}

.person-item:active {
    transform: scale(0.97);
}

.person-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 25px var(--primary-glow);
}

.person-avatar.admin-avatar {
    background: linear-gradient(135deg, var(--danger), #dc2626);
}

.person-info {
    flex: 1;
    min-width: 0;
}

.person-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}

.person-group {
    font-size: 11px;
    color: var(--text-muted);
}

.forwarded-badge {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.6;
}

.forwarded-badge i {
    font-size: 10px;
}

.forward-chat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.08s ease;
    border: 1px solid transparent;
}

.forward-chat-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--primary);
}

.forward-chat-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
}

.forward-chat-avatar.group {
    background: linear-gradient(135deg, var(--success), #059669);
}

.forward-chat-avatar.admin-chat-avatar {
    background: linear-gradient(135deg, var(--danger), #dc2626);
}

.forward-chat-info {
    flex: 1;
    min-width: 0;
}

.forward-chat-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.forward-chat-meta {
    font-size: 11px;
    color: var(--text-muted);
}

#forwardPreview {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    border-left: 3px solid var(--primary);
    margin-top: 16px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

/* ============================================================
   ПУСТОЙ ЧАТ В МЕССЕНДЖЕРЕ
   ============================================================ */
.messenger-messages .empty-conversation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    padding: 60px 24px;
    height: 100%;
    min-height: 300px;
    color: var(--text-muted);
    animation: messengerEmptyFadeIn 0.5s ease;
}

.messenger-messages .empty-conversation i {
    font-size: 72px;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 0.85;
    display: block;
    filter: drop-shadow(0 0 30px var(--primary-glow));
    animation: messengerEmptyIconFloat 3s ease-in-out infinite;
}

.messenger-messages .empty-conversation p {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.4;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #ffffff 20%, var(--primary-light) 60%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    max-width: 320px;
}

.messenger-messages .empty-conversation small,
.messenger-messages .empty-conversation .empty-hint {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0.8;
    max-width: 300px;
    line-height: 1.6;
    display: block;
}

.messenger-messages .empty-conversation::after {
    content: '↓';
    display: block;
    margin-top: 12px;
    font-size: 20px;
    color: var(--primary-light);
    opacity: 0.5;
    animation: messengerEmptyArrow 1.8s ease-in-out infinite;
}

@keyframes messengerEmptyFadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes messengerEmptyIconFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

@keyframes messengerEmptyArrow {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(6px); opacity: 0.9; }
}

/* ============================================================
   ПОДДЕРЖКА — СТУДЕНТ
   ============================================================ */
.messenger-container {
    display: grid;
    grid-template-columns: 340px 1fr;
    overflow: hidden;
    height: 640px;
    max-height: 78vh;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.chats-sidebar {
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chats-header {
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.chats-header h3 {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.chats-header h3 i {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #ffffff;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-md);
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: opacity 0.15s ease;
    font-family: var(--font);
    letter-spacing: 0.3px;
}

.new-chat-btn:hover {
    opacity: 0.9;
}

.new-chat-btn:active {
    opacity: 0.8;
}

.new-chat-btn i {
    font-size: 14px;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chats-list::-webkit-scrollbar {
    width: 5px;
}

.chats-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.chats-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

.chat-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    min-width: 0;
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(124, 58, 237, 0.3);
}

.chat-item.active {
    background: rgba(124, 58, 237, 0.1);
    border-color: var(--primary);
}

.chat-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #ffffff;
    flex-shrink: 0;
}

.chat-avatar.anonymous {
    background: linear-gradient(135deg, var(--warning), #d97706);
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--text-primary);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.chat-last-message {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.chat-last-message i {
    font-size: 10px;
    margin-right: 4px;
}

.chat-time {
    font-size: 10px;
    color: var(--text-dim);
    flex-shrink: 0;
    margin-top: 2px;
    font-weight: 500;
}

.badge-answered,
.badge-pending {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-answered {
    background: var(--success-dim);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-pending {
    background: var(--warning-dim);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.conversation-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.05);
    min-width: 0;
}

.conversation-header {
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
}

.conversation-user {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.conversation-user-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
}

.conversation-user-info {
    min-width: 0;
}

.conversation-user-info h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-user-info span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.03);
}

.messages-area::-webkit-scrollbar {
    width: 5px;
}

.messages-area::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.messages-area .empty-conversation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
    text-align: center;
}

.messages-area .empty-conversation i {
    font-size: 52px;
    opacity: 0.15;
    color: var(--text-dim);
}

.messages-area .empty-conversation p {
    font-size: 14px;
    font-weight: 500;
}

.message-bubble {
    display: flex;
    gap: 12px;
    max-width: 78%;
    min-width: 0;
}

.message-bubble.student {
    align-self: flex-start;
}

.message-bubble.admin {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar-small {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    color: #ffffff;
}

.message-bubble.student .message-avatar-small {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.message-bubble.admin .message-avatar-small {
    background: linear-gradient(135deg, var(--success), #059669);
}

.message-content {
    padding: 12px 18px;
    border-radius: 16px;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
    min-width: 0;
}

.message-bubble.student .message-content {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-bottom-left-radius: 4px;
    color: #ffffff;
}

.message-bubble.admin .message-content {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-bottom-right-radius: 4px;
    color: var(--text-primary);
}

.message-text {
    font-size: 13.5px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
    min-width: 0;
}

.message-time {
    font-size: 10px;
    margin-top: 6px;
    opacity: 0.6;
    display: block;
}

.message-bubble.student .message-time {
    color: rgba(255, 255, 255, 0.75);
    text-align: left;
}

.message-bubble.admin .message-time {
    color: var(--text-muted);
    text-align: right;
}

.message-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 0;
    position: relative;
}

.message-date-separator::before,
.message-date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.message-date-separator span {
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 16px;
    border-radius: var(--radius-full);
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin: 0 12px;
    border: 1px solid var(--glass-border);
}

.message-input-area {
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.message-input-area textarea {
    flex: 1;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-primary);
    resize: none;
    font-family: var(--font);
    font-size: 13.5px;
    min-height: 46px;
    max-height: 140px;
    outline: none;
    transition: border-color 0.15s ease;
    line-height: 1.5;
}

.message-input-area textarea::placeholder {
    color: var(--text-dim);
}

.message-input-area textarea:focus {
    border-color: var(--primary);
}

.send-message-btn {
    width: 46px;
    height: 46px;
    min-width: 46px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    transition: opacity 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-family: var(--font);
}

.send-message-btn:hover {
    opacity: 0.9;
}

.send-message-btn:active {
    opacity: 0.8;
}

.send-message-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-message-btn i {
    transform: translateX(1px);
}

/* ============================================================
   ПОДДЕРЖКА — АДМИН
   ============================================================ */
.admin-delete-chat-btn {
    padding: 8px 16px;
    background: var(--danger-dim);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-full);
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: var(--font);
}

.admin-delete-chat-btn:hover {
    background: var(--danger);
    color: #ffffff;
}

.admin-support-stats {
    display: flex;
    gap: 10px;
    align-items: center;
}

.unread-tickets-badge,
.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: var(--danger-dim);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-full);
    color: var(--danger);
    font-size: 12px;
    font-weight: 700;
}

/* ============================================================
   АДАПТИВ — МОБИЛЬНЫЙ
   ============================================================ */
@media (max-width: 900px) {
    .messenger-container {
        grid-template-columns: 280px 1fr;
        height: 600px;
    }

    .chat-name {
        font-size: 12px;
    }

    .chat-last-message {
        font-size: 11px;
    }
}

@media (max-width: 700px) {
    .messenger-container {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
    }

    .chats-sidebar {
        width: 100%;
        max-height: 400px;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }

    .conversation-area {
        min-height: 500px;
    }

    .messages-area {
        padding: 16px;
    }

    .message-bubble {
        max-width: 88%;
    }

    .message-content {
        padding: 10px 14px;
    }

    .message-text {
        font-size: 13px;
    }

    .conversation-header {
        padding: 12px 16px;
    }

    .message-input-area {
        padding: 12px 14px;
    }

    .conversation-user-avatar {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 17px;
        border-radius: 10px;
    }

    .conversation-user-info h4 {
        font-size: 14px;
    }
}

@media (max-width: 600px) {
    .messenger-messages .empty-conversation {
        padding: 40px 16px;
        gap: 12px;
    }

    .messenger-messages .empty-conversation i {
        font-size: 56px;
    }

    .messenger-messages .empty-conversation p {
        font-size: 15px;
    }

    .messenger-messages .empty-conversation small,
    .messenger-messages .empty-conversation .empty-hint {
        font-size: 12px;
    }
}

/* ============================================================
   СВЕТЛАЯ ТЕМА
   ============================================================ */
body.light-theme .chats-sidebar {
    background: rgba(255, 255, 255, 0.5);
}

body.light-theme .chats-header {
    background: rgba(255, 255, 255, 0.4);
}

body.light-theme .chat-item {
    background: rgba(0, 0, 0, 0.03);
}

body.light-theme .chat-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .chat-item.active {
    background: rgba(124, 58, 237, 0.08);
}

body.light-theme .conversation-header {
    background: rgba(255, 255, 255, 0.5);
}

body.light-theme .message-input-area {
    background: rgba(255, 255, 255, 0.4);
}

body.light-theme .message-input-area textarea {
    background: rgba(0, 0, 0, 0.04);
}

body.light-theme .message-bubble.admin .message-content {
    background: rgba(16, 185, 129, 0.08);
}

body.light-theme .message-date-separator span {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .messages-area {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme .messenger-messages .empty-conversation p {
    background: linear-gradient(135deg, #1a1a2e 20%, #7c3aed 60%, #ec4899 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body.light-theme .messenger-messages .empty-conversation i {
    filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.3));
}

/* ============================================================
   ПУСТЫЕ СОСТОЯНИЯ
   ============================================================ */
.chats-list .empty-conversation,
.messages-area .empty-conversation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-muted);
}

.chats-list .empty-conversation i,
.messages-area .empty-conversation i {
    font-size: 52px;
    opacity: 0.15;
    color: var(--text-dim);
    display: block;
    margin-bottom: 4px;
}

.chats-list .empty-conversation p,
.messages-area .empty-conversation p {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.chats-list .empty-conversation {
    padding: 60px 20px;
    height: 100%;
    justify-content: center;
}

.chats-list .empty-conversation i {
    font-size: 44px;
    opacity: 0.12;
}

.chats-list .empty-conversation p {
    font-size: 13px;
}

.admin-chats-list .empty-conversation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
}

.admin-chats-list .empty-conversation i {
    font-size: 44px;
    opacity: 0.12;
    color: var(--text-dim);
    display: block;
    margin-bottom: 4px;
}

.admin-chats-list .empty-conversation p {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.conversation-area .empty-conversation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    text-align: center;
    gap: 14px;
    padding: 40px 20px;
    color: var(--text-muted);
}

.conversation-area .empty-conversation i {
    font-size: 64px;
    opacity: 0.1;
    color: var(--text-dim);
    display: block;
    margin-bottom: 6px;
}

.conversation-area .empty-conversation p {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
    max-width: 300px;
}

.messenger-chats-list .empty-conversation,
.people-search-list .empty-conversation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 60px 20px;
    height: 100%;
    color: var(--text-muted);
    min-height: 300px;
}

.messenger-chats-list .empty-conversation i,
.people-search-list .empty-conversation i {
    font-size: 52px;
    opacity: 0.15;
    color: var(--text-dim);
    display: block;
    margin-bottom: 6px;
}

.messenger-chats-list .empty-conversation p,
.people-search-list .empty-conversation p {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    max-width: 260px;
}

.messenger-chats-list .empty-conversation p + p,
.people-search-list .empty-conversation p + p,
.messenger-chats-list .empty-conversation small,
.people-search-list .empty-conversation small {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    opacity: 0.75;
    margin-top: -4px;
    line-height: 1.6;
    max-width: 260px;
}

.people-search-list .empty-conversation {
    padding: 50px 20px;
}

.people-search-list .empty-conversation i {
    font-size: 48px;
}

#messengerEmptyState {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}

#messengerEmptyState > i {
    font-size: 56px;
    margin-bottom: 8px;
    opacity: 0.15;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: block;
}

#messengerEmptyState > p {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    max-width: 300px;
}

#messengerEmptyState > small {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.7;
    max-width: 280px;
    line-height: 1.6;
    display: block;
}

.messenger-chats-list .empty-conversation i.fa-user-friends,
.people-search-list .empty-conversation i.fa-user-friends {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 0.25;
}

/* ============================================================
   AI-АССИСТЕНТ — ПЛАВАЮЩАЯ КНОПКА + МОДАЛЬНОЕ ОКНО
   ============================================================ */

/* ---------- Плавающая кнопка ---------- */
.ai-floating-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    border: none;
    color: #ffffff;
    font-size: 26px;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 32px rgba(124, 58, 237, 0.5),
        0 0 0 0 rgba(124, 58, 237, 0.7);
    animation: aiBtnPulse 2.5s infinite;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease,
                opacity 0.3s ease;
}

.ai-floating-btn:hover {
    transform: scale(1.12) rotate(-8deg);
    box-shadow:
        0 12px 48px rgba(124, 58, 237, 0.7),
        0 0 0 12px rgba(124, 58, 237, 0.1);
    animation-play-state: paused;
}

.ai-floating-btn:active {
    transform: scale(0.95);
}

.ai-floating-btn i {
    animation: aiBtnIconFloat 3s ease-in-out infinite;
}

.ai-floating-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 999px;
    border: 2px solid var(--bg-deep);
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.ai-floating-btn-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
}

@keyframes aiBtnPulse {
    0% {
        box-shadow:
            0 8px 32px rgba(124, 58, 237, 0.5),
            0 0 0 0 rgba(124, 58, 237, 0.6);
    }
    50% {
        box-shadow:
            0 8px 32px rgba(124, 58, 237, 0.5),
            0 0 0 16px rgba(124, 58, 237, 0);
    }
    100% {
        box-shadow:
            0 8px 32px rgba(124, 58, 237, 0.5),
            0 0 0 0 rgba(124, 58, 237, 0);
    }
}

@keyframes aiBtnIconFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-3px) rotate(-8deg); }
    75% { transform: translateY(3px) rotate(8deg); }
}

/* ---------- Модальное окно ---------- */
.ai-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 24px;
    pointer-events: none;
}

.ai-modal.active {
    display: flex;
    pointer-events: auto;
}

.ai-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ai-modal.active .ai-modal-overlay {
    opacity: 1;
}

.ai-modal-content {
    position: relative;
    width: 420px;
    max-width: calc(100vw - 48px);
    height: 620px;
    max-height: calc(100vh - 48px);
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(124, 58, 237, 0.2);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease;
}

.ai-modal.active .ai-modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ---------- Шапка ---------- */
.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(236, 72, 153, 0.1));
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
    animation: aiHeaderAvatarPulse 2.5s ease-in-out infinite;
}

@keyframes aiHeaderAvatarPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 4px 24px rgba(236, 72, 153, 0.6); }
}

.ai-chat-header-info h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 2px;
    color: var(--text-primary);
}

.ai-chat-header-info span {
    font-size: 11px;
    color: #10b981;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-header-info span i {
    font-size: 8px;
    animation: aiOnlinePulse 2s ease-in-out infinite;
}

@keyframes aiOnlinePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.ai-chat-header-actions {
    display: flex;
    gap: 8px;
}

.ai-header-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.15s ease;
}

.ai-header-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: scale(1.08);
}

.ai-header-btn.ai-close-btn:hover {
    background: #ef4444;
    color: #fff;
    border-color: transparent;
}

/* ---------- Область сообщений ---------- */
.ai-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.ai-messages-area::-webkit-scrollbar {
    width: 6px;
}

.ai-messages-area::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.ai-messages-area::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

.ai-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    min-width: 0;
    animation: aiMessageAppear 0.3s ease;
}

@keyframes aiMessageAppear {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.ai-message.ai-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-message.ai-assistant {
    align-self: flex-start;
}

.ai-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.ai-user .ai-avatar {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

.ai-assistant .ai-avatar {
    background: linear-gradient(135deg, #ec4899, #be185d);
}

.ai-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    min-width: 0;
    font-size: 13.5px;
    line-height: 1.5;
}

.ai-user .ai-bubble {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-assistant .ai-bubble {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

.ai-text {
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
}

.ai-time {
    font-size: 9px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

/* ---------- Индикатор "печатает" ---------- */
.ai-typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.ai-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-light);
    animation: aiTypingBounce 1.2s ease-in-out infinite;
}

.ai-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes aiTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ---------- Поле ввода ---------- */
.ai-input-area {
    display: flex;
    gap: 8px;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
    align-items: flex-end;
    flex-shrink: 0;
}

.ai-input-area textarea {
    flex: 1;
    padding: 11px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    color: var(--text-primary);
    resize: none;
    font-family: var(--font);
    font-size: 13.5px;
    min-height: 42px;
    max-height: 100px;
    outline: none;
    transition: border-color 0.15s ease;
    line-height: 1.4;
}

.ai-input-area textarea:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

.ai-input-area textarea::placeholder {
    color: var(--text-dim);
}

.ai-send-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.ai-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.5);
}

.ai-send-btn:active {
    transform: scale(0.95);
}

.ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---------- Пустое состояние ---------- */
.ai-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    gap: 10px;
    color: var(--text-muted);
    padding: 30px 20px;
}

.ai-empty i {
    font-size: 56px;
    opacity: 0.25;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: aiEmptyFloat 3s ease-in-out infinite;
}

@keyframes aiEmptyFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.ai-empty p {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.ai-empty small {
    font-size: 12px;
    opacity: 0.7;
    line-height: 1.5;
    max-width: 260px;
}

/* ---------- Адаптив ---------- */
@media (max-width: 600px) {
    .ai-floating-btn {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .ai-modal {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .ai-modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border: none;
    }

    .ai-chat-header {
        padding: 14px 16px;
    }

    .ai-message {
        max-width: 90%;
    }

    .ai-bubble {
        font-size: 13px;
    }
}

/* ---------- Светлая тема ---------- */
body.light-theme .ai-modal-content {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(124, 58, 237, 0.15);
}

body.light-theme .ai-assistant .ai-bubble {
    background: rgba(124, 58, 237, 0.06);
    border-color: rgba(124, 58, 237, 0.12);
}

body.light-theme .ai-input-area {
    background: rgba(0, 0, 0, 0.03);
}

body.light-theme .ai-input-area textarea {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .ai-header-btn {
    background: rgba(0, 0, 0, 0.05);
}