/* ==================== СТИЛИ ЧАТА И ЭМОДЗИ ==================== */

/* ═══════════════════════════════════════════════════════
   КИБЕРПАНК ЧАТ (Sci-Fi HUD)
   ═══════════════════════════════════════════════════════ */
   
/* Убираем подложку модалки, чтобы был чистый HUD */
.modal-box:has(.cp-chat-wrapper) {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 700px !important;
    width: 95vw !important;
}
.modal-box:has(.cp-chat-wrapper) .modal-body {
    padding: 0 !important;
}

.cp-chat-wrapper {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: #02050a; /* Очень темный синий */
    position: relative;
    font-family: 'Consolas', monospace;
    /* Форма срезанных углов */
    clip-path: polygon(
        30px 0, calc(100% - 30px) 0, 100% 30px,
        100% calc(100% - 30px), calc(100% - 30px) 100%,
        30px 100%, 0 calc(100% - 30px), 0 30px
    );
    border: 1px solid #00ffff; /* Неоновая рамка */
    box-shadow: 
        inset 0 0 30px rgba(0, 255, 255, 0.1),
        0 0 20px rgba(0, 255, 255, 0.3);
}

/* Имитация микросхем на фоне (линии) */
.cp-bg-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: 
        linear-gradient(90deg, rgba(0,255,255,0.03) 1px, transparent 1px),
        linear-gradient(rgba(0,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
}

/* Шапка */
.cp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: linear-gradient(90deg, rgba(0,255,255,0.1) 0%, transparent 50%, rgba(0,255,255,0.1) 100%);
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    position: relative;
    z-index: 1;
}
.cp-header::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 10%; right: 10%; height: 1px;
    background: #00ffff;
    box-shadow: 0 0 10px #00ffff;
}
.cp-header-left { display: flex; align-items: center; gap: 15px; }
.cp-icon { width: 28px; height: 28px; filter: drop-shadow(0 0 5px #00ffff); }
.cp-title { color: #00ffff; font-size: 16px; font-weight: bold; letter-spacing: 3px; text-shadow: 0 0 10px rgba(0,255,255,0.6); }
.cp-subtitle { color: #8b949e; font-size: 11px; margin-top: 4px; text-transform: uppercase; }
.cp-close-btn {
    background: transparent; border: 1px solid rgba(0,255,255,0.3); color: #00ffff;
    width: 30px; height: 30px; cursor: pointer; font-size: 14px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: all 0.2s;
}
.cp-close-btn:hover { background: rgba(0,255,255,0.2); box-shadow: 0 0 10px #00ffff; }

/* Область сообщений */
.cp-messages-area {
    flex: 1; overflow-y: auto; padding: 20px 30px; display: flex; flex-direction: column; gap: 15px;
    position: relative; z-index: 1;
}
.cp-messages-area::-webkit-scrollbar { width: 4px; }
.cp-messages-area::-webkit-scrollbar-thumb { background: #00ffff; box-shadow: 0 0 5px #00ffff; }

/* Пузыри сообщений */
.cp-msg {
    max-width: 80%; padding: 12px 16px; font-size: 13px; line-height: 1.5;
    position: relative; background: rgba(0, 20, 30, 0.7); border: 1px solid rgba(0, 255, 255, 0.3);
}
.cp-msg::before {
    content: ''; position: absolute; width: 4px; height: 100%; top: 0;
    background: var(--user-color, #00ffff); box-shadow: 0 0 8px var(--user-color, #00ffff);
}

.cp-msg.cp-in {
    align-self: flex-start;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%);
}
.cp-msg.cp-in::before { left: -1px; }

.cp-msg.cp-out {
    align-self: flex-end; background: rgba(0, 40, 50, 0.8); border-color: rgba(0, 255, 255, 0.5);
    clip-path: polygon(15px 0, 100% 0, 100% 100%, 0 100%, 0 15px);
}
.cp-msg.cp-out::before { right: -1px; left: auto; }

.cp-author { color: var(--user-color, #00ffff); font-size: 11px; font-weight: bold; margin-bottom: 5px; letter-spacing: 1px; text-shadow: 0 0 5px var(--user-color, rgba(0,255,255,0.5)); }
.cp-text { color: #e6edf3; }
.cp-time { color: rgba(0, 255, 255, 0.5); font-size: 10px; text-align: right; margin-top: 5px; }

/* Поле ввода */
.cp-input-area {
    display: flex; align-items: center; padding: 15px 30px; gap: 15px;
    background: linear-gradient(0deg, rgba(0,255,255,0.1) 0%, transparent 100%);
    border-top: 1px solid rgba(0, 255, 255, 0.3);
    position: relative; z-index: 1;
}
.cp-input-area::before {
    content: ''; position: absolute; top: -2px; left: 10%; right: 10%; height: 1px;
    background: #00ffff; box-shadow: 0 0 10px #00ffff;
}

.cp-icon-btn {
    background: transparent; border: 1px solid #00ffff; color: #00ffff;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    font-size: 18px; cursor: pointer;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: all 0.2s;
}
.cp-icon-btn:hover { background: rgba(0,255,255,0.2); box-shadow: 0 0 15px rgba(0,255,255,0.5); }

.cp-input-wrapper {
    flex: 1; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(0, 255, 255, 0.4);
    padding: 0 15px; display: flex; align-items: center; height: 40px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: border-color 0.2s;
}
.cp-input-wrapper:focus-within { border-color: #00ffff; box-shadow: inset 0 0 15px rgba(0,255,255,0.1); }
.cp-input-wrapper input {
    width: 100%; background: transparent !important; border: none !important;
    color: #00ffff !important; font-size: 13px; font-family: 'Consolas', monospace;
    outline: none !important; padding: 10px 0 !important; text-transform: uppercase;
}
.cp-input-wrapper input::placeholder { color: rgba(0, 255, 255, 0.3); }

.cp-send-btn {
    background: rgba(0,255,255,0.1); border: 1px solid #00ffff; color: #00ffff;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.cp-send-btn:hover { background: rgba(0,255,255,0.3); box-shadow: 0 0 15px #00ffff; }


/* ═══════════════════════════════════════════════════════
   МЕГА-ЭМОДЗИ ПИКЕР
   ═══════════════════════════════════════════════════════ */
.emoji-picker {
    display: none;
    position: fixed;
    z-index: 99999999 !important; /* Поверх всех модалок */
    background: var(--bg-2);
    border: 1px solid var(--border-2);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    padding: 10px;
    width: 360px;
    max-width: calc(100vw - 20px);
    flex-direction: column;
}

.emoji-search-wrap {
    margin-bottom: 8px;
}

.emoji-search {
    width: 100%;
    background: var(--bg-3);
    border: 1px solid var(--border-2);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
}
.emoji-search:focus {
    border-color: var(--green-hi);
}

.emoji-picker-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-2);
}

.emoji-cat-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.15s;
}
.emoji-cat-btn:hover {
    background: rgba(255,255,255,0.05);
}
.emoji-cat-btn.active {
    background: rgba(74, 106, 58, 0.2);
    border-color: var(--green-hi);
    color: var(--green-hi);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.emoji-grid::-webkit-scrollbar { width: 6px; }
.emoji-grid::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

.emoji-item {
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
}
.emoji-item:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.2);
}

/* Тактическая сетка на фоне */
    background-image: 
        linear-gradient(rgba(126, 231, 135, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(126, 231, 135, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    border: 1px solid var(--border-2);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
}

.task-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Пузыри сообщений */
.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: relative;
    word-wrap: break-word;
}

.chat-msg.my-msg {
    align-self: flex-end;
    background: linear-gradient(135deg, #2ea043 0%, #238636 100%);
    border: 1px solid #3fb950;
    border-bottom-right-radius: 2px; /* Эффект хвостика */
    color: white;
}

.chat-msg.other-msg {
    align-self: flex-start;
    background: #21262d;
    border: 1px solid #30363d;
    border-bottom-left-radius: 2px; /* Эффект хвостика */
    color: #e6edf3;
}

.chat-msg-header {
    font-size: 10px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    opacity: 0.8;
}

.chat-msg-author {
    font-weight: 700;
}

/* Зона ввода (Капсула) */
.task-chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #161b22;
    border-top: 1px solid #30363d;
}

.chat-input-wrap {
    flex: 1;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 20px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    transition: border-color 0.2s;
}

.chat-input-wrap:focus-within {
    border-color: var(--green-hi);
    box-shadow: 0 0 10px rgba(92, 138, 72, 0.2);
}

.chat-input-wrap input {
    width: 100%;
    background: transparent !important;
    border: none !important;
    padding: 10px 0 !important;
    color: var(--text) !important;
    outline: none !important;
    box-shadow: none !important;
}

.chat-send-btn {
    background: #238636;
    color: white;
    border: 1px solid #3fb950;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.chat-send-btn:hover {
    background: #2ea043;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(63, 185, 80, 0.4);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

/* Кнопка эмодзи (делаем круглой) */
.task-chat-input-area .emoji-trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    background: #21262d;
    border: 1px solid #30363d;
}

/* Скроллбар */
.task-chat-messages::-webkit-scrollbar { width: 6px; }
.task-chat-messages::-webkit-scrollbar-track { background: transparent; }
.task-chat-messages::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
.task-chat-messages::-webkit-scrollbar-thumb:hover { background: var(--green-hi); }

/* Цвет фона Telegram */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin: -10px; /* Компенсация padding модалки */
}

/* Шапка */
.tg-chat-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #17212b;
    border-bottom: 1px solid #101921;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    z-index: 10;
}

.tg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2b5278;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 12px;
}

.tg-chat-title {
    flex: 1;
}

.tg-name {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.tg-status {
    font-size: 12px;
    color: #7d8b99;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.tg-online-dot {
    width: 8px;
    height: 8px;
    background: #4dcd5e;
    border-radius: 50%;
    display: inline-block;
}

.tg-close-btn {
    background: transparent;
    border: none;
    color: #7d8b99;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    transition: 0.2s;
}
.tg-close-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Область сообщений */
.tg-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Обои Telegram */
    background-image: url('https://web.telegram.org/a/chat-bg-pattern-dark.png');
    background-size: cover;
    background-blend-mode: overlay;
}

/* Скроллбар */
.tg-messages-area::-webkit-scrollbar { width: 6px; }
.tg-messages-area::-webkit-scrollbar-thumb { background: #2b5278; border-radius: 3px; }

/* Пузыри */
.tg-msg {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.tg-msg.tg-in {
    align-self: flex-start;
    background: #182533;
    color: #fff;
    border-bottom-left-radius: 4px;
}

.tg-msg.tg-out {
    align-self: flex-end;
    background: #2b5278;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.tg-author {
    font-size: 12px;
    font-weight: 600;
    color: #6ab2f2;
    margin-bottom: 2px;
}

.tg-text {
    line-height: 1.4;
    word-wrap: break-word;
}

.tg-time {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    align-self: flex-end;
    margin-top: 4px;
    margin-bottom: -4px;
    margin-right: -4px;
}

/* Поле ввода */
.tg-input-area {
    display: flex;
    align-items: flex-end;
    padding: 10px;
    background: #17212b;
    gap: 10px;
}

.tg-icon-btn {
    background: transparent;
    border: none;
    color: #7d8b99;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tg-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

.tg-input-wrapper {
    flex: 1;
    background: #242f3d;
    border-radius: 18px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    min-height: 40px;
}

.tg-input-wrapper input {
    width: 100%;
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    font-size: 14px;
    outline: none !important;
    box-shadow: none !important;
    padding: 10px 0 !important;
}

.tg-input-wrapper input::placeholder {
    color: #7d8b99;
}

.tg-send-btn {
    background: #5288c1;
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
}
.tg-send-btn:hover { background: #6ab2f2; transform: scale(1.05); }
.tg-send-btn:active { transform: scale(0.95); }

/* Прячем подложку модалки под чат */
.modal-box:has(.tg-chat-wrapper) {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 600px !important;
}
.modal-box:has(.tg-chat-wrapper) .modal-body {
    padding: 0 !important;
}

/* Убираем лишние отступы и фон модалки, если внутри чат */
.modal-box:has(.tg-chat-wrapper) {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 600px !important;
}
.modal-box:has(.tg-chat-wrapper) .modal-body {
    padding: 0 !important;
}

/* Шапка */
.tg-chat-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #17212b;
    border-bottom: 1px solid #101921;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    z-index: 10;
}
.tg-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: #2b5278; display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-right: 12px;
}
.tg-chat-title { flex: 1; }
.tg-name { font-weight: 600; font-size: 14px; color: #fff; }
.tg-status { font-size: 12px; color: #7d8b99; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.tg-online-dot { width: 8px; height: 8px; background: #4dcd5e; border-radius: 50%; display: inline-block; }
.tg-close-btn {
    background: transparent; border: none; color: #7d8b99; cursor: pointer;
    padding: 5px; border-radius: 50%; display: flex; transition: 0.2s;
}
.tg-close-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Область сообщений */
.tg-messages-area {
    flex: 1; overflow-y: auto; padding: 20px 20px 10px 20px;
    display: flex; flex-direction: column; gap: 8px;
    background: #0e1621;
}
.tg-messages-area::-webkit-scrollbar { width: 6px; }
.tg-messages-area::-webkit-scrollbar-thumb { background: #2b5278; border-radius: 3px; }

/* Пузыри */
.tg-msg {
    max-width: 75%; padding: 8px 12px; border-radius: 12px;
    font-size: 14px; position: relative; display: flex; flex-direction: column;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2); animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.tg-msg.tg-in { align-self: flex-start; background: #182533; color: #fff; border-bottom-left-radius: 4px; }
.tg-msg.tg-out { align-self: flex-end; background: #2b5278; color: #fff; border-bottom-right-radius: 4px; }
.tg-author { font-size: 12px; font-weight: 600; color: #6ab2f2; margin-bottom: 2px; }
.tg-text { line-height: 1.4; word-wrap: break-word; }
.tg-time { font-size: 11px; color: rgba(255,255,255,0.6); align-self: flex-end; margin-top: 4px; margin-bottom: -4px; margin-right: -4px; }

/* Поле ввода */
.tg-input-area {
    display: flex; align-items: flex-end; padding: 10px 15px;
    background: #17212b; gap: 10px;
}
.tg-icon-btn {
    background: transparent; border: none; color: #7d8b99; cursor: pointer;
    padding: 8px; border-radius: 50%; transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
.tg-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.tg-input-wrapper {
    flex: 1; background: #242f3d; border-radius: 18px; padding: 0 15px;
    display: flex; align-items: center; min-height: 40px;
}
.tg-input-wrapper input {
    width: 100%; background: transparent !important; border: none !important;
    color: #fff !important; font-size: 14px; outline: none !important; box-shadow: none !important; padding: 10px 0 !important;
}
.tg-input-wrapper input::placeholder { color: #7d8b99; }
.tg-send-btn {
    background: #5288c1; color: #fff; border: none; width: 40px; height: 40px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.2s; flex-shrink: 0;
}
.tg-send-btn:hover { background: #6ab2f2; transform: scale(1.05); }
.tg-send-btn:active { transform: scale(0.95); }

/* Убираем лишние отступы и фон модалки, если внутри чат */
.modal-box:has(.tg-chat-wrapper) {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 600px !important;
}
.modal-box:has(.tg-chat-wrapper) .modal-body {
    padding: 0 !important;
}

/* Шапка */
.tg-chat-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #17212b;
    border-bottom: 1px solid #101921;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    z-index: 10;
}
.tg-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: #2b5278; display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-right: 12px;
}
.tg-chat-title { flex: 1; }
.tg-name { font-weight: 600; font-size: 14px; color: #fff; }
.tg-status { font-size: 12px; color: #7d8b99; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.tg-online-dot { width: 8px; height: 8px; background: #4dcd5e; border-radius: 50%; display: inline-block; }
.tg-close-btn {
    background: transparent; border: none; color: #7d8b99; cursor: pointer;
    padding: 5px; border-radius: 50%; display: flex; transition: 0.2s;
}
.tg-close-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Область сообщений */
.tg-messages-area {
    flex: 1; overflow-y: auto; padding: 20px 20px 10px 20px;
    display: flex; flex-direction: column; gap: 8px;
    background: #0e1621;
}
.tg-messages-area::-webkit-scrollbar { width: 6px; }
.tg-messages-area::-webkit-scrollbar-thumb { background: #2b5278; border-radius: 3px; }

/* Пузыри */
.tg-msg {
    max-width: 75%; padding: 8px 12px; border-radius: 12px;
    font-size: 14px; position: relative; display: flex; flex-direction: column;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2); animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.tg-msg.tg-in { align-self: flex-start; background: #182533; color: #fff; border-bottom-left-radius: 4px; }
.tg-msg.tg-out { align-self: flex-end; background: #2b5278; color: #fff; border-bottom-right-radius: 4px; }
.tg-author { font-size: 12px; font-weight: 600; color: #6ab2f2; margin-bottom: 2px; }
.tg-text { line-height: 1.4; word-wrap: break-word; }
.tg-time { font-size: 11px; color: rgba(255,255,255,0.6); align-self: flex-end; margin-top: 4px; margin-bottom: -4px; margin-right: -4px; }

/* Поле ввода */
.tg-input-area {
    display: flex; align-items: flex-end; padding: 10px 15px;
    background: #17212b; gap: 10px;
}
.tg-icon-btn {
    background: transparent; border: none; color: #7d8b99; cursor: pointer;
    padding: 8px; border-radius: 50%; transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
.tg-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.tg-input-wrapper {
    flex: 1; background: #242f3d; border-radius: 18px; padding: 0 15px;
    display: flex; align-items: center; min-height: 40px;
}
.tg-input-wrapper input {
    width: 100%; background: transparent !important; border: none !important;
    color: #fff !important; font-size: 14px; outline: none !important; box-shadow: none !important; padding: 10px 0 !important;
}
.tg-input-wrapper input::placeholder { color: #7d8b99; }
.tg-send-btn {
    background: #5288c1; color: #fff; border: none; width: 40px; height: 40px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.2s; flex-shrink: 0;
}
.tg-send-btn:hover { background: #6ab2f2; transform: scale(1.05); }
.tg-send-btn:active { transform: scale(0.95); }

/* Фикс пикера эмодзи */
.emoji-picker {
    z-index: 9999999 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8) !important;
}

/* Убираем лишние отступы модалки */
.modal-box:has(.hud-chat-container) {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 650px !important;
}
.modal-box:has(.hud-chat-container) .modal-body {
    padding: 0 !important;
}

/* Шапка */
.hud-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(90deg, rgba(22, 27, 34, 0.9) 0%, rgba(13, 17, 23, 0.9) 100%);
    border-bottom: 1px solid #30363d;
    position: relative;
}
.hud-chat-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #7ee787, transparent);
}
.hud-chat-title { display: flex; align-items: center; gap: 15px; }
.hud-icon { font-size: 24px; color: #7ee787; text-shadow: 0 0 10px #7ee787; }
.hud-name { font-size: 16px; color: #e6edf3; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
.hud-status { font-size: 11px; color: #7ee787; margin-top: 4px; letter-spacing: 2px; display: flex; align-items: center; gap: 6px; }
.hud-status::before { content: ''; display: block; width: 6px; height: 6px; background: #7ee787; border-radius: 50%; box-shadow: 0 0 5px #7ee787; }
.hud-close-btn { background: transparent; border: 1px solid #30363d; color: #8b949e; cursor: pointer; padding: 5px 10px; border-radius: 4px; transition: 0.2s; }
.hud-close-btn:hover { color: #f85149; border-color: #f85149; box-shadow: 0 0 10px rgba(248, 81, 73, 0.3); }

/* Область сообщений */
.hud-messages-area {
    flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 15px;
    background-image: 
        linear-gradient(rgba(126, 231, 135, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(126, 231, 135, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
}
.hud-messages-area::-webkit-scrollbar { width: 6px; }
.hud-messages-area::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

/* Сообщения (Угловатые пузыри) */
.hud-msg {
    max-width: 75%; padding: 12px 16px; position: relative; font-size: 13px; line-height: 1.4;
    border: 1px solid #30363d; background: rgba(22, 27, 34, 0.8); backdrop-filter: blur(5px);
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
}
.hud-msg.hud-in {
    align-self: flex-start; border-color: #4a6a3a; color: #e6edf3;
    box-shadow: -5px 5px 15px rgba(0,0,0,0.5); border-left: 3px solid #7ee787;
}
.hud-msg.hud-out {
    align-self: flex-end; border-color: #2a5f88; color: #e6edf3;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.5); border-right: 3px solid #58a6ff;
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
}
.hud-author { font-size: 11px; color: #7ee787; font-weight: bold; margin-bottom: 6px; text-transform: uppercase; }
.hud-text { word-wrap: break-word; }
.hud-time { font-size: 10px; color: #8b949e; text-align: right; margin-top: 6px; }

/* Поле ввода */
.hud-input-area {
    display: flex; align-items: center; padding: 15px; background: rgba(13, 17, 23, 0.9);
    border-top: 1px solid #30363d; gap: 12px;
}
.hud-icon-btn {
    background: transparent; border: 1px solid #30363d; color: #7ee787; cursor: pointer;
    width: 40px; height: 40px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 18px;
    transition: 0.2s;
}
.hud-icon-btn:hover { border-color: #7ee787; box-shadow: 0 0 10px rgba(126, 231, 135, 0.3); }
.hud-input-wrapper {
    flex: 1; border: 1px solid #30363d; background: rgba(0,0,0,0.5); padding: 0 15px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.hud-input-wrapper:focus-within { border-color: #7ee787; box-shadow: inset 0 0 10px rgba(126, 231, 135, 0.1); }
.hud-input-wrapper input {
    width: 100%; background: transparent !important; border: none !important;
    color: #fff !important; font-size: 13px; font-family: 'Consolas', monospace; outline: none !important; padding: 12px 0 !important;
}
.hud-input-wrapper input::placeholder { color: #4a6a3a; }
.hud-send-btn {
    background: rgba(74, 106, 58, 0.3); color: #7ee787; border: 1px solid #7ee787;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 18px;
    cursor: pointer; transition: 0.2s;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.hud-send-btn:hover { background: rgba(74, 106, 58, 0.6); box-shadow: 0 0 15px #7ee787; }




/* Стили для тактических кнопок чата */
.cp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: #00ffff;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
    flex-shrink: 0;
}

.cp-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
    border-color: #00ffff;
}

.cp-btn:active {
    transform: scale(0.95);
}

.cp-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Если у старой кнопки был класс с border-radius, перебиваем его */
.cp-btn-emoji, .cp-btn-send {
    border-radius: 0 !important;
}

/* Тактические кнопки ввода */
.cp-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: #00ffff;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
    /* Срезанный угол для киберпанк-стиля */
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}

.cp-action-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.5);
    border-color: #00ffff;
}

.cp-action-btn:active {
    transform: scale(0.92);
}

.cp-action-btn svg {
    display: block;
    width: 22px;
    height: 22px;
}

/* ЖЕСТКИЕ ПРАВИЛА ДЛЯ КНОПОК ЧАТА (V4) */
.cp-input-area {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px !important;
    height: auto !important;
    background: transparent !important;
}

.cp-icon-btn, .cp-send-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    border-radius: 0 !important;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%) !important;
    background: rgba(0, 255, 255, 0.05) !important;
    border: 1px solid rgba(0, 255, 255, 0.4) !important;
    color: #00ffff !important;
    cursor: pointer !important;
}

.cp-icon-btn:hover, .cp-send-btn:hover {
    background: rgba(0, 255, 255, 0.15) !important;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4) !important;
}

.cp-input-wrapper {
    flex-grow: 1 !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
}

.cp-input-wrapper input {
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    font-size: 14px !important;
}

/* ИДЕАЛЬНОЕ ВЫРАВНИВАНИЕ (V4.1) */
.cp-input-area {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px !important;
}

.cp-icon-btn, .cp-send-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    border-radius: 0 !important;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%) !important;
    background: rgba(0, 255, 255, 0.05) !important;
    border: 1px solid rgba(0, 255, 255, 0.4) !important;
    color: #00ffff !important;
    cursor: pointer !important;
}

.cp-icon-btn:hover, .cp-send-btn:hover {
    background: rgba(0, 255, 255, 0.15) !important;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4) !important;
}

.cp-input-wrapper {
    flex-grow: 1 !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
}

.cp-input-wrapper input {
    width: 100% !important;
    height: 44px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    font-size: 14px !important;
}

/* ФИНАЛЬНОЕ ВЫРАВНИВАНИЕ КНОПОК */
.cp-input-area {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}
.cp-icon-btn, .cp-send-btn {
    align-self: center !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    top: 0 !important;
    position: relative !important;
}

/* Жесткое выравнивание правой кнопки */
.cp-send-btn {
    height: 44px !important;
    min-height: 44px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* СТРОГОЕ ВЫРАВНИВАНИЕ ПО ЦЕНТРУ */
.cp-input-area { display: flex !important; align-items: center !important; }
.cp-icon-btn, .cp-send-btn {
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    top: 0 !important;
    vertical-align: middle !important;
}

/* ФИНАЛЬНОЕ ВЫРАВНИВАНИЕ (V6) */
.cp-input-area {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}
.cp-icon-btn, .cp-send-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    align-self: center !important;
    flex-shrink: 0 !important;
    border-radius: 0 !important;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%) !important;
    background: rgba(0, 255, 255, 0.05) !important;
    border: 1px solid rgba(0, 255, 255, 0.4) !important;
    color: #00ffff !important;
    cursor: pointer !important;
}
.cp-input-wrapper {
    display: flex !important;
    align-items: center !important;
    height: 44px !important;
    flex-grow: 1 !important;
}
.cp-input-wrapper input {
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}
