/* ==================== СБРОС И БАЗОВЫЕ СТИЛИ ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: #0a0a0c;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.app {
    width: 100%;
    height: 100vh;
    max-width: 1920px;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

/* ==================== СОХРАНЕННЫЕ СООБЩЕНИЯ ==================== */
.saved-badge {
    font-size: 12px;
    opacity: 0.8;
}

/* ==================== ТЕМЫ (10 цветов) ==================== */
.theme-dark {
    --bg-primary: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --bg-tertiary: #3a3a3c;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --accent: #9333ea;
    --accent-hover: #a855f7;
    --danger: #ff6b6b;
    --success: #4cd964;
    --warning: #ff9f0a;
    --border: rgba(147, 51, 234, 0.2);
    --menu-text: rgba(255, 255, 255, 0.9);
    --menu-text-hover: #ffffff;
    --menu-bg: rgba(44, 44, 46, 0.95);
}

.theme-light {
    --bg-primary: #f2f2f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e5ea;
    --text-primary: #000000;
    --text-secondary: #6c6c70;
    --accent: #9333ea;
    --accent-hover: #a855f7;
    --danger: #ff3b30;
    --success: #34c759;
    --warning: #ff9f0a;
    --border: rgba(147, 51, 234, 0.3);
    --menu-text: rgba(0, 0, 0, 0.9);
    --menu-text-hover: #ffffff;
    --menu-bg: rgba(255, 255, 255, 0.95);
}

.theme-blue {
    --bg-primary: #0a1a2f;
    --bg-secondary: #1a2a3f;
    --bg-tertiary: #2a3a4f;
    --text-primary: #ffffff;
    --text-secondary: #a0b0c0;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: rgba(59, 130, 246, 0.3);
    --menu-text: rgba(255, 255, 255, 0.9);
    --menu-text-hover: #ffffff;
    --menu-bg: rgba(26, 42, 63, 0.95);
}

.theme-green {
    --bg-primary: #0f2f1f;
    --bg-secondary: #1f3f2f;
    --bg-tertiary: #2f4f3f;
    --text-primary: #ffffff;
    --text-secondary: #a0c0b0;
    --accent: #10b981;
    --accent-hover: #34d399;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: rgba(16, 185, 129, 0.3);
    --menu-text: rgba(255, 255, 255, 0.9);
    --menu-text-hover: #ffffff;
    --menu-bg: rgba(31, 63, 47, 0.95);
}

.theme-purple {
    --bg-primary: #1f0f2f;
    --bg-secondary: #2f1f3f;
    --bg-tertiary: #3f2f4f;
    --text-primary: #ffffff;
    --text-secondary: #c0a0d0;
    --accent: #a855f7;
    --accent-hover: #c084fc;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: rgba(168, 85, 247, 0.3);
    --menu-text: rgba(255, 255, 255, 0.9);
    --menu-text-hover: #ffffff;
    --menu-bg: rgba(47, 31, 63, 0.95);
}

.theme-orange {
    --bg-primary: #2f1a0f;
    --bg-secondary: #3f2a1f;
    --bg-tertiary: #4f3a2f;
    --text-primary: #ffffff;
    --text-secondary: #d0b0a0;
    --accent: #f97316;
    --accent-hover: #fb923c;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: rgba(249, 115, 22, 0.3);
    --menu-text: rgba(255, 255, 255, 0.9);
    --menu-text-hover: #ffffff;
    --menu-bg: rgba(63, 42, 31, 0.95);
}

.theme-pink {
    --bg-primary: #2f0f1f;
    --bg-secondary: #3f1f2f;
    --bg-tertiary: #4f2f3f;
    --text-primary: #ffffff;
    --text-secondary: #d0a0b0;
    --accent: #ec4899;
    --accent-hover: #f472b6;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: rgba(236, 72, 153, 0.3);
    --menu-text: rgba(255, 255, 255, 0.9);
    --menu-text-hover: #ffffff;
    --menu-bg: rgba(63, 31, 47, 0.95);
}

.theme-cyan {
    --bg-primary: #0f2f2f;
    --bg-secondary: #1f3f3f;
    --bg-tertiary: #2f4f4f;
    --text-primary: #ffffff;
    --text-secondary: #a0d0d0;
    --accent: #06b6d4;
    --accent-hover: #22d3ee;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: rgba(6, 182, 212, 0.3);
    --menu-text: rgba(255, 255, 255, 0.9);
    --menu-text-hover: #ffffff;
    --menu-bg: rgba(31, 63, 63, 0.95);
}

.theme-yellow {
    --bg-primary: #2f2f0f;
    --bg-secondary: #3f3f1f;
    --bg-tertiary: #4f4f2f;
    --text-primary: #ffffff;
    --text-secondary: #d0d0a0;
    --accent: #eab308;
    --accent-hover: #facc15;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: rgba(234, 179, 8, 0.3);
    --menu-text: rgba(255, 255, 255, 0.9);
    --menu-text-hover: #ffffff;
    --menu-bg: rgba(63, 63, 31, 0.95);
}

.theme-red {
    --bg-primary: #2f0f0f;
    --bg-secondary: #3f1f1f;
    --bg-tertiary: #4f2f2f;
    --text-primary: #ffffff;
    --text-secondary: #d0a0a0;
    --accent: #ef4444;
    --accent-hover: #f87171;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: rgba(239, 68, 68, 0.3);
    --menu-text: rgba(255, 255, 255, 0.9);
    --menu-text-hover: #ffffff;
    --menu-bg: rgba(63, 31, 31, 0.95);
}

/* ==================== АНИМИРОВАННЫЙ ФОН ==================== */
.app::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 30% 50%, rgba(147, 51, 234, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 70% 50%, rgba(79, 70, 229, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 30%, rgba(236, 72, 153, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 60% 70%, rgba(59, 130, 246, 0.03) 0%, transparent 50%);
    animation: rotate 40s linear infinite;
    pointer-events: none;
}

.app::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, transparent 0%, rgba(10, 10, 12, 0.4) 100%);
    pointer-events: none;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== ЭКРАН АВТОРИЗАЦИИ ==================== */
.auth-screen {
    max-width: 380px;
    width: 90%;
    margin: auto;
    padding: 32px 24px;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.5s ease;
    position: relative;
    z-index: 10;
    border: 1px solid var(--border);
    text-align: center;
}

.auth-screen::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, #9333ea, #4f46e5, #ec4899, #3b82f6);
    border-radius: 25px;
    z-index: -1;
    opacity: 0.3;
    filter: blur(5px);
    animation: borderGlow 3s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.3; filter: blur(5px); }
    50% { opacity: 0.6; filter: blur(8px); }
}

.auth-logo {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, #9333ea, #4f46e5, #ec4899, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
    animation: gradientShift 4s ease infinite;
    background-size: 300% 300%;
}

.auth-welcome {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 600;
}

.auth-welcome span {
    background: linear-gradient(135deg, #9333ea, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.auth-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.2);
}

.auth-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: 12px;
    padding: 14px;
    color: white;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 16px;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(147, 51, 234, 0.3);
}

.auth-switch {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-switch span {
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-switch span:hover {
    text-decoration: underline;
}

/* ==================== ОСНОВНОЙ ИНТЕРФЕЙС ==================== */
.main-screen {
    display: none;
    flex: 1;
    height: 100%;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.main-screen.active {
    display: flex;
}

/* Левая панель */
.chats-sidebar {
    width: 280px;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Профиль */
.profile-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.profile-header:hover {
    background: rgba(147, 51, 234, 0.1);
}

.profile-avatar {
    width: 42px;
    height: 42px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    position: relative;
    border: 2px solid var(--border);
    flex-shrink: 0;
    animation: avatarGlow 3s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.2s ease;
    border-radius: 50%;
}

.profile-avatar:hover {
    transform: scale(1.05);
}

.profile-avatar::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #9333ea, #4f46e5, #ec4899, #3b82f6);
    z-index: -1;
    opacity: 0.5;
    animation: rotate 4s linear infinite;
    border-radius: 50%;
}

@keyframes avatarGlow {
    0%, 100% { box-shadow: 0 0 10px var(--accent); }
    50% { box-shadow: 0 0 20px var(--accent), 0 0 30px #4f46e5; }
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-status {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    color: var(--danger);
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 20px;
    background: rgba(255, 107, 107, 0.1);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.logout-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

/* Поиск */
.search-section {
    padding: 12px 16px;
    position: relative;
}

.search-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.2);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-results {
    position: absolute;
    top: 55px;
    left: 16px;
    right: 16px;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 30;
    border: 1px solid var(--border);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.search-item {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: rgba(147, 51, 234, 0.1);
}

.search-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.search-avatar {
    width: 36px;
    height: 36px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
}

.search-info {
    min-width: 0;
}

.search-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-username {
    color: var(--accent);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.add-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.add-btn:hover {
    transform: scale(1.05);
}

.friend-badge {
    color: var(--success);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    background: rgba(76, 217, 100, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(76, 217, 100, 0.2);
}

.blocked-badge {
    color: var(--danger);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(255, 107, 107, 0.2);
}

/* Список чатов */
.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-item {
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    position: relative;
}

.chat-item:hover {
    background: rgba(147, 51, 234, 0.1);
}

.chat-item.active {
    background: rgba(147, 51, 234, 0.15);
}

.chat-item.pinned {
    border-left: 3px solid var(--accent);
}

.chat-avatar {
    width: 45px;
    height: 45px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    position: relative;
    flex-shrink: 0;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s ease;
    border-radius: 50%;
}

.chat-avatar:hover {
    transform: scale(1.05);
}

/* ==================== УЛУЧШЕННЫЙ ИНДИКАТОР ОНЛАЙН ==================== */
.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #4cd964;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    z-index: 5;
    box-shadow: 0 0 5px rgba(76, 217, 100, 0.5);
}

/* Для сообщений */
.msg-avatar .online-indicator {
    width: 8px;
    height: 8px;
    bottom: 0px;
    right: 0px;
    border-width: 1.5px;
}

/* Для списка чатов */
.chat-avatar .online-indicator {
    width: 10px;
    height: 10px;
    bottom: 2px;
    right: 2px;
}

/* Анимация как в Telegram (пульсирующая) */
.online-indicator.pulse {
    animation: tgPulse 2s ease infinite;
}

@keyframes tgPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 217, 100, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(76, 217, 100, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 217, 100, 0);
    }
}

/* Для сообщений - чуть меньше пульсация */
.msg-avatar .online-indicator.pulse {
    animation: tgPulseSmall 2s ease infinite;
}

@keyframes tgPulseSmall {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 217, 100, 0.7);
    }
    70% {
        box-shadow: 0 0 0 4px rgba(76, 217, 100, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 217, 100, 0);
    }
}

/* Для каналов - скрываем индикатор */
.chat-avatar.channel .online-indicator,
.header-avatar.channel .online-indicator {
    display: none;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    color: var(--text-secondary);
    font-size: 10px;
}

.chat-last-msg {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-badge {
    background: var(--accent);
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 12px;
    min-width: 18px;
    text-align: center;
}

/* Правая панель */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    min-width: 0;
}

/* Шапка чата */
.chat-header {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.header-avatar {
    width: 42px;
    height: 42px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 17px;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform 0.2s ease;
    border-radius: 50%;
}

.header-avatar:hover {
    transform: scale(1.05);
}

.header-info {
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.header-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-status {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-status.online {
    color: var(--success);
}

.header-actions {
    display: flex;
    gap: 8px;
    position: relative;
}

.header-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
}

.header-btn:hover {
    background: rgba(147, 51, 234, 0.2);
    border-color: var(--accent);
}

/* Выпадающее меню */
.dropdown-menu {
    position: absolute;
    top: 45px;
    right: 0;
    background: var(--menu-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 6px 0;
    min-width: 200px;
    z-index: 50;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(147, 51, 234, 0.3);
}

.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.dropdown-item {
    padding: 10px 16px;
    color: var(--menu-text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 0 5px currentColor;
}

.dropdown-item:hover {
    background: var(--accent);
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger:hover {
    background: var(--danger);
    color: white;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

/* Контекстное меню (ПКМ) */
.context-menu {
    position: fixed;
    background: var(--menu-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 260px;
    z-index: 10000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 30px var(--accent), 0 0 60px var(--accent);
    animation: fadeIn 0.15s ease;
}

.context-menu-item {
    padding: 12px 18px;
    color: var(--menu-text);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    text-shadow: 0 0 8px var(--accent);
}

.context-menu-item:hover {
    background: var(--accent);
    color: white;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
}

.context-menu-item.danger {
    color: var(--danger);
    text-shadow: 0 0 8px var(--danger);
}

.context-menu-item.danger:hover {
    background: var(--danger);
    color: white;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
}

.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.reactions-menu {
    display: flex;
    justify-content: space-around;
    padding: 10px 18px;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin: 4px 8px;
}

.reaction-option {
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 6px;
    border-radius: 50%;
    filter: drop-shadow(0 0 5px currentColor);
}

.reaction-option:hover {
    transform: scale(1.3);
    filter: drop-shadow(0 0 10px var(--accent));
    background: rgba(147, 51, 234, 0.2);
}

/* Контейнер сообщений */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-primary);
    background-image: var(--chat-wallpaper, none);
}

/* Сообщения */
.message {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    max-width: 60%;
    animation: messageIn 0.2s ease;
    position: relative;
}

.message.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.pinned {
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 4px;
}

.message.edited::after {
    content: 'ред.';
    font-size: 9px;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* УЛУЧШЕННЫЙ ОТВЕТ - В ОДНУ СТРОКУ С ЧЕРНЫМ ТЕКСТОМ */
.reply-to {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reply-to:hover {
    background: rgba(0, 0, 0, 0.1);
}

.reply-icon {
    font-size: 12px;
    color: #000000;
}

.reply-sender {
    font-weight: 600;
    color: #000000;
}

.reply-message {
    color: #333333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Для своих сообщений */
.message.own .reply-to {
    background: rgba(255, 255, 255, 0.1);
}

.message.own .reply-icon,
.message.own .reply-sender,
.message.own .reply-message {
    color: #ffffff;
}

.msg-avatar {
    width: 28px;
    height: 28px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform 0.2s ease;
    border-radius: 50%;
}

.msg-avatar:hover {
    transform: scale(1.1);
}

.bubble {
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
    word-break: break-word;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.4;
    max-width: 100%;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.message.own .bubble {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 4px;
    color: white;
}

.msg-time {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

/* Реакции */
.reactions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.reaction-item {
    background: rgba(147, 51, 234, 0.1);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 4px 8px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.reaction-item:hover {
    background: rgba(147, 51, 234, 0.2);
    transform: scale(1.05);
}

.reaction-item.active {
    background: var(--accent);
    color: white;
}

.reaction-count {
    font-size: 11px;
    font-weight: 600;
}

/* Анимации для эмодзи */
.emoji-animation {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    animation: emojiFloat 2s ease-out forwards;
    font-size: 50px;
}

@keyframes emojiFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-120px) scale(2);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 12px;
    height: 12px;
    background: var(--accent);
    animation: confettiFall 3s linear forwards;
    z-index: 10000;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.rain-drop {
    position: fixed;
    width: 3px;
    height: 25px;
    background: linear-gradient(transparent, var(--accent));
    animation: rain 1s linear infinite;
    z-index: 10000;
}

@keyframes rain {
    0% {
        transform: translateY(-100vh);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

.heart {
    position: fixed;
    color: #ff4d4d;
    font-size: 25px;
    animation: heartFloat 1.5s ease-out forwards;
    z-index: 10000;
}

@keyframes heartFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-120px) scale(2);
        opacity: 0;
    }
}

.win-line {
    position: absolute;
    height: 5px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover), gold);
    border-radius: 3px;
    box-shadow: 0 0 25px gold;
    z-index: 5;
    animation: winPulse 0.5s ease infinite;
}

@keyframes winPulse {
    0%, 100% { opacity: 0.8; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.5); }
}

.trophy {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 100px;
    animation: trophySpin 1s ease;
    z-index: 10001;
    pointer-events: none;
}

@keyframes trophySpin {
    0% { transform: translate(-50%, -50%) rotate(0deg) scale(0); }
    50% { transform: translate(-50%, -50%) rotate(180deg) scale(1.5); }
    100% { transform: translate(-50%, -50%) rotate(360deg) scale(1); }
}

.star {
    position: fixed;
    color: gold;
    font-size: 25px;
    animation: starTwinkle 1s ease-out forwards;
    z-index: 10001;
    pointer-events: none;
}

@keyframes starTwinkle {
    0% { transform: scale(0) rotate(0deg); opacity: 1; }
    100% { transform: scale(2) rotate(360deg); opacity: 0; }
}

.dice-animation {
    position: fixed;
    font-size: 70px;
    animation: diceSpin 1s ease-out forwards;
    z-index: 10000;
    pointer-events: none;
}

@keyframes diceSpin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) rotate(720deg) scale(2);
        opacity: 0;
    }
}

/* Эмодзи-сообщения */
.emoji-message {
    font-size: 60px;
    line-height: 1;
    text-align: center;
    padding: 8px;
    animation: emojiPop 0.3s ease;
}

@keyframes emojiPop {
    0% { transform: scale(0); }
    80% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Фото */
.message-image {
    max-width: 250px;
    max-height: 250px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-image:hover {
    transform: scale(1.02);
}

/* Файлы */
.file-message {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border);
}

.file-icon {
    font-size: 24px;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.file-size {
    font-size: 11px;
    color: var(--text-secondary);
}

.file-download {
    color: var(--accent);
    cursor: pointer;
    font-size: 18px;
}

/* Аудио сообщения */
.audio-message {
    background: var(--bg-tertiary);
    border-radius: 25px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    min-width: 200px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-message:hover {
    border-color: var(--accent);
}

.audio-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.audio-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--accent);
}

.audio-play-btn.playing {
    animation: pulse 1s ease infinite;
}

.audio-wave-container {
    flex: 1;
    height: 28px;
    position: relative;
    cursor: pointer;
}

.audio-wave-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
}

.audio-wave-progress {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 14px;
    transition: width 0.1s linear;
    pointer-events: none;
}

.audio-time {
    color: var(--text-secondary);
    font-size: 11px;
    min-width: 40px;
    text-align: right;
    font-weight: 500;
}

.audio-speed {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 14px;
    padding: 3px 6px;
    font-size: 9px;
    cursor: pointer;
}

/* Опросы */
.poll-message {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    min-width: 240px;
}

.poll-question {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.poll-option {
    margin-bottom: 8px;
}

.poll-option-text {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.poll-bar-bg {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

.poll-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Игры */
.game-message {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.game-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
    position: relative;
}

.game-cell {
    aspect-ratio: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    color: var(--text-primary);
    border-radius: 8px;
}

.game-cell:hover {
    background: rgba(147, 51, 234, 0.1);
    transform: scale(1.05);
}

.game-cell.winner {
    background: linear-gradient(135deg, gold, orange);
    color: white;
    animation: winnerPulse 0.5s ease infinite;
}

@keyframes winnerPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px gold; }
    50% { transform: scale(1.1); box-shadow: 0 0 30px gold; }
}

.game-cell.winner::after {
    content: '👑';
    position: absolute;
    top: -12px;
    right: -12px;
    font-size: 18px;
    animation: crownFloat 1s ease infinite;
}

@keyframes crownFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Кубик */
.dice-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dice-message:hover {
    border-color: var(--accent);
}

.dice-emoji {
    font-size: 36px;
    animation: diceRoll 0.5s ease;
}

@keyframes diceRoll {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(180deg); }
    75% { transform: rotate(270deg); }
    100% { transform: rotate(360deg); }
}

.dice-number {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Закрепленные сообщения */
.pinned-messages-bar {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
}

.pinned-messages-bar:hover {
    background: rgba(147, 51, 234, 0.1);
}

.pinned-icon {
    color: var(--accent);
    flex-shrink: 0;
}

.pinned-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.pinned-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    flex: 1;
}

.pinned-counter {
    color: var(--text-secondary);
    font-size: 12px;
    flex-shrink: 0;
}

.pinned-arrow {
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 6px;
    flex-shrink: 0;
}

.pinned-arrow:hover {
    color: var(--accent);
}

.pinned-close {
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
}

.pinned-close:hover {
    color: var(--danger);
}

/* Поле ввода */
.input-area {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-direction: column;
}

/* УЛУЧШЕННОЕ ПРЕВЬЮ ОТВЕТА - как в Telegram */
.reply-preview {
    background: var(--bg-tertiary);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.reply-preview-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.reply-preview-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.reply-preview-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.reply-preview-sender {
    font-weight: 600;
    color: var(--accent);
    font-size: 11px;
    margin-bottom: 2px;
}

.reply-preview-message {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-preview-close {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    margin-left: 8px;
    flex-shrink: 0;
}

.reply-preview-close:hover {
    color: var(--danger);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-controls {
    display: flex;
    gap: 8px;
    width: 100%;
}

/* Эмодзи панель */
.emoji-panel {
    max-height: 220px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin-bottom: 6px;
    display: none;
}

.emoji-panel.show {
    display: block;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

.emoji-item {
    font-size: 26px;
    text-align: center;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.emoji-item:hover {
    background: rgba(147, 51, 234, 0.2);
}

.attach-btn, .emoji-btn, .voice-btn, .dice-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.attach-btn:hover, .emoji-btn:hover, .voice-btn:hover, .dice-btn:hover {
    background: rgba(147, 51, 234, 0.2);
    border-color: var(--accent);
}

.voice-btn.recording {
    background: rgba(255, 107, 107, 0.3);
    border-color: var(--danger);
    animation: pulse 1s ease infinite;
}

.message-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.message-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.2);
}

.message-input::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.5);
}

/* Индикатор записи */
.recording-indicator {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 107, 107, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 24px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.recording-indicator.active {
    display: flex;
    animation: slideUp 0.2s ease;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: pulse 1s ease infinite;
}

/* Блокировка сообщения */
.blocked-message {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin: 12px;
}

.blocked-message button {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    margin-top: 10px;
    cursor: pointer;
    font-size: 13px;
}

.blocked-message button:hover {
    background: var(--accent-hover);
}

/* МОДАЛЬНЫЕ ОКНА */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    padding: 20px;
    color: white;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--accent);
    animation: modalIn 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 40px var(--accent);
}

.modal-content * {
    color: var(--text-primary);
}

.modal-lg {
    max-width: 650px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 28px;
    text-align: center;
    background: linear-gradient(135deg, #9333ea, #a855f7, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(147, 51, 234, 0.5);
    letter-spacing: -0.5px;
}

/* УЛУЧШЕННЫЙ ПРОФИЛЬ - ВСЕ КРУГЛОЕ КРОМЕ МОДАЛКИ С КАРТИНКОЙ */
.avatar-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
    font-weight: 600;
    cursor: pointer;
    border: 3px solid var(--accent);
    background-size: cover;
    background-position: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 0 3px var(--bg-secondary), 0 0 20px var(--accent);
    border-radius: 50%;
}

.avatar-preview.has-image::after {
    content: '🔍';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.avatar-preview.has-image:hover::after {
    opacity: 1;
}

.avatar-preview:hover {
    transform: scale(1.02);
    border-color: var(--accent-hover);
}

/* Аватарка в полный размер */
.fullsize-avatar {
    width: 300px;
    height: 300px;
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    border: 4px solid var(--accent);
    box-shadow: 0 0 30px var(--accent);
    margin: 0 auto;
}

/* Профиль в чате - КРУГЛЫЙ */
.profile-avatar-large {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
    font-weight: 600;
    cursor: pointer;
    border: 4px solid var(--accent);
    background-size: cover;
    background-position: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px var(--accent);
    border-radius: 50%;
}

.profile-avatar-large.has-image::after {
    content: '🔍';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.profile-avatar-large.has-image:hover::after {
    opacity: 1;
}

.reset-avatar {
    text-align: center;
    margin: 12px 0 24px;
}

.reset-avatar-btn {
    background: rgba(147, 51, 234, 0.1);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-avatar-btn:hover {
    background: rgba(147, 51, 234, 0.2);
    box-shadow: 0 0 15px rgba(147, 51, 234, 0.3);
}

.modal-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px 20px;
    margin-bottom: 18px;
    font-size: 15px;
    transition: all 0.2s ease;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(147, 51, 234, 0.15);
}

.modal-input::placeholder {
    color: var(--text-secondary);
}

.color-picker {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin: 24px 0;
    justify-content: center;
}

.color-option {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.color-option:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px currentColor;
}

.color-option.selected {
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--accent);
}

.theme-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.theme-option:hover {
    transform: scale(1.15);
}

.theme-option.selected {
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--accent);
}

.wallpaper-section {
    margin-bottom: 18px;
    padding: 18px;
    background: var(--bg-tertiary);
    border-radius: 18px;
    text-align: center;
}

.wallpaper-placeholder {
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: 20px;
    padding: 18px;
    color: white;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 18px;
    box-shadow: 0 4px 15px rgba(147, 51, 234, 0.3);
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent);
}

.modal-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-shadow: none;
}

.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.modal-tab {
    padding: 10px 22px;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.modal-tab:hover {
    color: var(--accent);
}

.modal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.modal-tab-content {
    display: none;
}

.modal-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.privacy-settings {
    margin: 18px 0;
}

.privacy-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--accent);
}

.privacy-option {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    font-size: 15px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: 14px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.privacy-option:hover {
    border-color: var(--accent);
}

.privacy-option input[type="radio"] {
    accent-color: var(--accent);
    width: 20px;
    height: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    margin-bottom: 14px;
    color: var(--text-primary);
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: 14px;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 20px;
    height: 20px;
}

/* Подтверждение удаления */
.confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    padding: 28px;
    border-radius: 24px;
    border: 1px solid var(--accent);
    z-index: 2000;
    min-width: 300px;
    text-align: center;
    animation: fadeIn 0.2s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 30px var(--accent);
}

.confirm-dialog p {
    margin-bottom: 24px;
    font-size: 16px;
}

.confirm-dialog-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.confirm-btn.yes {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
}

.confirm-btn.no {
    background: rgba(255, 107, 107, 0.2);
    color: var(--danger);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.confirm-btn:hover {
    transform: translateY(-2px);
}

/* Тосты */
.toast {
    position: fixed;
    top: 25px;
    right: 25px;
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 16px 24px;
    font-size: 15px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 14px;
    animation: slideIn 0.3s ease;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid transparent;
}

.toast.success {
    border-color: var(--success);
    box-shadow: 0 0 20px var(--success);
}

.toast.error {
    border-color: var(--danger);
    box-shadow: 0 0 20px var(--danger);
}

.toast.info {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent);
}

.toast-close {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 18px;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==================== УЛУЧШЕННЫЙ ИНДИКАТОР В ПРОФИЛЕ ==================== */
.online-dot {
    width: 12px;
    height: 12px;
    background: #4cd964;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(76, 217, 100, 0.7);
    animation: tgPulseProfile 2s ease infinite;
}

.online-dot.pulse {
    animation: tgPulseProfile 2s ease infinite;
}

@keyframes tgPulseProfile {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 217, 100, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(76, 217, 100, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 217, 100, 0);
    }
}

/* Для своего профиля (чуть больше) */
.profile-avatar-large + h2 + p + .online-dot {
    width: 14px;
    height: 14px;
}

/* ТОЛЬКО ДЛЯ УВЕЛИЧЕННОЙ АВАТАРКИ ПРИ КЛИКЕ - КВАДРАТНАЯ БЕЗ РАМОК */
.modal[style*="z-index: 10001"] .modal-content img,
.modal[style*="z-index: 10001"] .modal-content div[style*="background"] {
    border-radius: 12px !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Аватарка в настройках профиля - КРУГЛАЯ */
#profileModal .avatar-preview {
    border-radius: 50% !important;
}

/* ==================== БЛОКИРОВКА ЧАТА ==================== */
.blocked-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 59, 48, 0.1);
    border: 2px solid rgba(255, 59, 48, 0.5);
    border-radius: 12px;
    margin: 8px 0;
    color: #ff3b30;
    font-weight: 500;
}

.blocked-lock {
    font-size: 24px;
}

.blocked-text {
    font-size: 16px;
}

.unblock-btn {
    background: #ff3b30;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unblock-btn:hover {
    background: #ff5252;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.5);
}

/* Большой блок с замком в центре чата */
.blocked-chat-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 40px;
    background: var(--bg-tertiary);
    border-radius: 24px;
    margin: 20px auto;
    max-width: 300px;
    color: #ff3b30;
    border: 2px solid rgba(255, 59, 48, 0.3);
    box-shadow: 0 10px 30px rgba(255, 59, 48, 0.2);
}

.blocked-lock-large {
    font-size: 60px;
    animation: lockShake 0.5s ease infinite;
}

.blocked-text-large {
    font-size: 20px;
    font-weight: 600;
}

.unblock-btn-large {
    background: #ff3b30;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.unblock-btn-large:hover {
    background: transparent;
    border-color: #ff3b30;
    color: #ff3b30;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.5);
}

@keyframes lockShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}
/* ==================== КНОПКА ПРОКРУТКИ ВНИЗ ==================== */
.scroll-down-btn {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px var(--accent);
    z-index: 100;
    transition: all 0.2s ease;
    animation: fadeIn 0.2s ease;
}

.scroll-down-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 30px var(--accent);
}

.scroll-down-btn span {
    font-size: 24px;
    line-height: 1;
}
/* 🔥 ИСПРАВЛЕНИЕ: эмодзи в модальных окнах без свечения */
.modal-title span:first-child {
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: initial !important;
    color: inherit !important;
    text-shadow: none !important;
    font-size: 32px;
}
/* ==================== НОВЫЙ ДИЗАЙН АУДИО СООБЩЕНИЙ ==================== */
.audio-message {
    background: var(--bg-tertiary);
    border-radius: 25px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    min-width: 200px;
    max-width: 300px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-message:hover {
    border-color: var(--accent);
}

.audio-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.audio-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--accent);
}

.audio-play-btn.playing {
    animation: pulse 1s ease infinite;
}

.audio-wave-container {
    flex: 1;
    height: 32px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.audio-waves {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 2px;
    z-index: 1;
}

.audio-wave {
    flex: 1;
    min-width: 2px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    transition: height 0.1s ease;
}

.message.own .audio-wave {
    background: rgba(255, 255, 255, 0.5);
}

.audio-wave-progress {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 14px;
    transition: width 0.1s linear;
    z-index: 2;
    opacity: 0.5;
    pointer-events: none;
}

.audio-time {
    color: var(--text-secondary);
    font-size: 11px;
    min-width: 40px;
    text-align: right;
    font-weight: 500;
    flex-shrink: 0;
}

.audio-speed {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 14px;
    padding: 3px 6px;
    font-size: 9px;
    cursor: pointer;
    flex-shrink: 0;
}
/* ==================== УЛУЧШЕННЫЕ ОБОИ ==================== */
.messages-container {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: local;
}
/* ==================== МОБИЛЬНАЯ АДАПТАЦИЯ ==================== */
@media (max-width: 768px) {
    .main-screen.active {
        flex-direction: column;
    }
    
    .chats-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 85%;
        max-width: 320px;
        z-index: 1000;
        transition: left 0.3s ease;
        background: var(--bg-secondary);
        box-shadow: 2px 0 20px rgba(0,0,0,0.3);
    }
    
    .chats-sidebar.open {
        left: 0;
    }
    
    .chat-area {
        width: 100%;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .chat-header {
        flex-shrink: 0;
        padding: 12px 16px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
    }
    
    .input-area {
        flex-shrink: 0;
        padding: 12px 16px;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
    }
    
    .messages-container {
        flex: 1;
        overflow-y: auto;
        padding: 25px 35px !important;
        min-height: 0;
    }
    
    .menu-toggle {
        display: flex !important;
    }
    
    .message {
        max-width: 85%;
    }
    
    .message-checkbox {
        left: -35px;
    }
    
    .message.own .message-checkbox {
        right: -35px;
    }
    
    .checkbox {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    .selection-bar {
        width: auto;
        min-width: 200px;
        max-width: 90%;
        bottom: 70px;
        padding: 8px 16px;
        white-space: nowrap;
        gap: 12px;
    }
    
    .bubble {
        max-width: calc(100% - 12px) !important;
    }
    
    .attach-btn, .emoji-btn, .voice-btn, .dice-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .send-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .message-input {
        font-size: 16px;
        padding: 10px 14px;
    }
    
    .input-controls {
        gap: 4px;
    }
    
    /* Контекстное меню */
    .context-menu {
        position: fixed !important;
        left: 5vw !important;
        right: 5vw !important;
        bottom: 20px !important;
        top: auto !important;
        width: 90vw !important;
        max-height: 70vh;
        overflow-y: auto;
        z-index: 10001;
    }
    
    /* Модальные окна */
    .modal-content {
        max-width: 95%;
        max-height: 85vh;
        padding: 20px 16px;
        margin: 10px;
    }
    
    .modal-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .modal-tab {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    /* Аватарки */
    .profile-avatar {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .chat-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .header-avatar {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .msg-avatar {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .avatar-preview,
    .profile-avatar-large {
        width: 100px;
        height: 100px;
        font-size: 40px;
    }
    
    /* Блокировка чата */
    .blocked-chat-message {
        padding: 25px;
        max-width: 90%;
    }
    
    /* Кнопка прокрутки */
    .scroll-down-btn {
        bottom: 80px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
    
    /* Индикатор записи */
    .recording-indicator {
        bottom: 100px;
        padding: 10px 20px;
        font-size: 14px;
    }
}
/* ==================== ПОЛЗУНОК РАЗМЕРА ШРИФТА ==================== */
.font-size-slider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 10px 15px;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.font-size-slider input[type="range"] {
    flex: 1;
    height: 5px;
    -webkit-appearance: none;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 5px;
    outline: none;
}

.font-size-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--accent);
}

.font-size-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.font-size-value {
    min-width: 45px;
    text-align: center;
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
}

/* ==================== ПЕРЕМЕННАЯ РАЗМЕРА ШРИФТА ==================== */
:root {
    --message-font-size: 14px;
}

.bubble {
    font-size: var(--message-font-size);
}

.message-input {
    font-size: calc(var(--message-font-size) - 1px);
}

/* ==================== ПОДСВЕТКА СООБЩЕНИЯ ==================== */
@keyframes pulse {
    0%, 100% { 
        background-color: transparent; 
        box-shadow: 0 0 0 0 var(--accent);
    }
    50% { 
        background-color: rgba(147, 51, 234, 0.2); 
        box-shadow: 0 0 20px var(--accent);
    }
}
/* ==================== УЛУЧШЕННЫЕ МЕДИА СООБЩЕНИЯ ==================== */
.media-message {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    max-width: 300px;
    border: 2px solid var(--accent);
    transition: all 0.2s ease;
}

.media-message:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px var(--accent);
}

.media-image, .media-video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
}

.media-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.media-message:hover .media-overlay {
    opacity: 1;
}

.media-download-icon, .media-play-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 0 20px var(--accent);
    margin: 0 5px;
}

.media-download-icon:hover, .media-play-icon:hover {
    transform: scale(1.1);
}

/* ==================== ИСПРАВЛЕННЫЕ АУДИО СООБЩЕНИЯ ==================== */
.audio-message-enhanced {
    background: var(--bg-tertiary);
    border-radius: 25px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid var(--accent);
    min-width: 260px;
    max-width: 350px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 5px 0;
    height: 52px; /* Фиксированная высота */
}

.audio-message-enhanced:hover {
    border-color: var(--accent-hover);
    box-shadow: 0 0 15px var(--accent);
}

.audio-play-btn-enhanced {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.audio-play-btn-enhanced:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--accent);
}

.audio-play-btn-enhanced.playing {
    animation: pulse 1s ease infinite;
}

.audio-wave-container-enhanced {
    flex: 1;
    height: 36px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 18px;
}

/* Контейнер для волн */
.audio-waves-enhanced {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    padding: 0 4px;
    z-index: 1;
    height: 100%;
}

/* Каждая волна */
.audio-wave-enhanced {
    flex: 1;
    min-width: 3px;
    max-width: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    transition: height 0.2s ease, background 0.2s ease;
    height: calc(30% + (var(--height, 0) * 0.7%));
    max-height: 100%;
}

/* Прогресс поверх волн */
.audio-wave-progress-enhanced {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 18px;
    transition: width 0.1s linear;
    z-index: 2;
    opacity: 0.3;
    pointer-events: none;
}

/* При воспроизведении - волны внутри прогресса окрашиваются */
.audio-message-enhanced.playing .audio-wave-enhanced {
    background: var(--accent);
}

/* Время */
.audio-time-enhanced {
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 45px;
    text-align: right;
    font-weight: 500;
    flex-shrink: 0;
}

/* Скорость */
.audio-speed-enhanced {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 14px;
    padding: 4px 8px;
    font-size: 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    height: 28px;
}

.audio-speed-enhanced:hover {
    background: var(--accent);
    color: white;
}

/* Для своих сообщений */
.message.own .audio-message-enhanced {
    background: rgba(255, 255, 255, 0.1);
}

.message.own .audio-wave-enhanced {
    background: rgba(255, 255, 255, 0.5);
}

.message.own .audio-message-enhanced.playing .audio-wave-enhanced {
    background: white;
}
/* ==================== КНОПКИ ДЛЯ МЕДИА В ПОЛНОЭКРАННОМ РЕЖИМЕ ==================== */
.media-download-btn, .media-close-btn {
    transition: all 0.2s ease;
}

.media-download-btn:hover, .media-close-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px var(--accent);
}

/* ==================== АНИМАЦИЯ ДЛЯ НОВЫХ АУДИО ==================== */
@keyframes wavePulse {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.2); }
}

.audio-wave-enhanced {
    animation: wavePulse 1s ease infinite;
    animation-delay: calc(0.1s * var(--i));
}
/* Стили для реакций на медиа */
.media-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    font-size: 13px;
}

/* Время для медиа */
.media-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.8;
}

.media-time {
    font-size: 11px;
}

/* Убираем рамку у закреплённых */
.message.pinned {
    background: linear-gradient(90deg, transparent, var(--accent-color) 20%, transparent);
    animation: pinGlow 2s ease-in-out infinite;
    border: none !important;
    outline: none !important;
}

.message.pinned .bubble {
    border: none !important;
    outline: none !important;
    box-shadow: 0 0 15px var(--accent-color);
}

@keyframes pinGlow {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
/* ==================== КРУГОВОЙ ИНДИКАТОР ЗАГРУЗКИ ==================== */
.video-upload-circle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 16px;
    min-width: 200px;
    max-width: 250px;
}

.video-upload-circle {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 12px;
}

.video-upload-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.video-upload-circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 6;
}

.video-upload-circle-bar {
    fill: none;
    stroke: var(--accent, #9333ea);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 226.2; /* Длина окружности: 2 * π * r (r=36) */
    stroke-dashoffset: 226.2;
    transition: stroke-dashoffset 0.2s ease;
    filter: drop-shadow(0 0 5px var(--accent, #9333ea));
}

.video-upload-circle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: bold;
    color: var(--accent, #9333ea);
    text-shadow: 0 0 8px var(--accent, #9333ea);
}

.video-upload-filename {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.video-upload-status {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    animation: uploadPulse 1.5s ease infinite;
}

.video-upload-status::before {
    content: '⏫';
    font-size: 14px;
    animation: uploadArrow 1s ease infinite;
}

@keyframes uploadArrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes uploadPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Вращение круга (анимация загрузки) */
.video-upload-circle-bar.animating {
    animation: circleRotate 2s linear infinite;
}

@keyframes circleRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Для темной темы */
.theme-dark .video-upload-circle-bg {
    stroke: rgba(255, 255, 255, 0.15);
}

/* Для светлой темы */
.theme-light .video-upload-circle-bg {
    stroke: rgba(0, 0, 0, 0.1);
}