/* AI Chat Styles */

:root {
    --ai-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --ai-primary-solid: #667eea;
    --ai-primary-dark: #5568d3;
}

/* Плавающая кнопка чата */
.ai-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
    z-index: 9999;
}

.ai-chat-btn:hover {
    transform: scale(1.1);
    background: transparent;
    box-shadow: none;
}

.ai-chat-ball {
    display: inline-block;
    transition: transform 0.6s ease;
}

.ai-chat-btn:hover .ai-chat-ball {
    transform: rotate(360deg);
}

.ai-chat-btn svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* Окно чата - дефолтная тема */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 600px;
    background: #1e2530;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s, background 0.3s;
    z-index: 9998;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Заголовок чата */
.ai-chat-header {
    padding: 20px;
    background: var(--ai-primary);
    color: white;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
}

.ai-chat-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.ai-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

/* Область сообщений - дефолтная тема */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #1e2530;
    transition: background 0.3s;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

/* Сообщения */
.message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message.ai .message-avatar {
    background: transparent;
}

.message.user .message-avatar {
    background: transparent;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.ai .message-content {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message.user .message-content {
    background: var(--success-color, #4CAF50);
    color: white;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Кнопки выбора */
.message-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.message-button {
    padding: 8px 16px;
    background: var(--ai-primary-solid);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.message-button:hover {
    background: var(--ai-primary-dark);
    transform: translateY(-1px);
}

.message-button:active {
    transform: translateY(0);
}

/* Индикатор печатает */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Область ввода */
.ai-chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

.ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    background: var(--input-bg, var(--bg-color));
    color: var(--text-color);
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    border-color: var(--ai-primary-solid);
}

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

.ai-chat-send:hover {
    background: var(--ai-primary-dark);
}

.ai-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .ai-chat-window {
        bottom: 90px;
        right: 5%;
        left: 5%;
        width: 90%;
        max-width: 90%;
        height: auto;
        max-height: 70vh;
        border-radius: 16px;
    }

    .ai-chat-window.active {
        transform: translateY(-70px) scale(1);
        pointer-events: all;
    }

    .ai-chat-header {
        border-radius: 16px 16px 0 0;
    }

    .ai-chat-btn {
        bottom: 20px;
        right: 20px;
    }
}

/* === АДАПТАЦИЯ ПОД ТЕМЫ САЙТА === */

/* Hacker Green */
body.theme-hacker-green .ai-chat-window {
    background: #001100;
    border-color: #00ff00;
}

body.theme-hacker-green .ai-chat-messages {
    background: #001100;
}

body.theme-hacker-green .ai-chat-header {
    background: linear-gradient(135deg, #003300 0%, #005500 100%);
}

body.theme-hacker-green .message.ai .message-content {
    background: #003300;
    color: #00ff00;
    box-shadow: 0 2px 8px rgba(0, 255, 0, 0.2);
    border: 1px solid #00ff00;
}

body.theme-hacker-green .message.user .message-content {
    background: #00aa00;
    color: #000000;
    box-shadow: 0 2px 8px rgba(0, 255, 0, 0.3);
}

body.theme-hacker-green .ai-chat-input {
    background: #001100;
    border-color: #00ff00;
    color: #00ff00;
}

body.theme-hacker-green .message-button {
    background: #00aa00;
    color: #000000;
}

/* Solarized */
body.theme-solarized .ai-chat-window {
    background: #073642;
    border-color: #586e75;
}

body.theme-solarized .ai-chat-messages {
    background: #073642;
}

body.theme-solarized .ai-chat-header {
    background: linear-gradient(135deg, #268bd2 0%, #2aa198 100%);
}

body.theme-solarized .message.ai .message-content {
    background: #104a5f;
    color: #93a1a1;
    box-shadow: 0 2px 8px rgba(38, 139, 210, 0.2);
    border: 1px solid #586e75;
}

body.theme-solarized .message.user .message-content {
    background: #268bd2;
    color: #fdf6e3;
    box-shadow: 0 2px 8px rgba(38, 139, 210, 0.3);
}

body.theme-solarized .ai-chat-input {
    background: #073642;
    border-color: #586e75;
    color: #93a1a1;
}

body.theme-solarized .message-button {
    background: #268bd2;
    color: #fdf6e3;
}

/* Matrix */
body.theme-matrix .ai-chat-window {
    background: #000a00;
    border-color: #00ff41;
}

body.theme-matrix .ai-chat-messages {
    background: #000a00;
}

body.theme-matrix .ai-chat-header {
    background: linear-gradient(135deg, #001100 0%, #002200 100%);
}

body.theme-matrix .message.ai .message-content {
    background: #002200;
    color: #00ff41;
    box-shadow: 0 2px 8px rgba(0, 255, 65, 0.2);
    border: 1px solid #00ff41;
}

body.theme-matrix .message.user .message-content {
    background: #00dd33;
    color: #000000;
    box-shadow: 0 2px 8px rgba(0, 255, 65, 0.3);
}

body.theme-matrix .ai-chat-input {
    background: #000a00;
    border-color: #00ff41;
    color: #00ff41;
}

body.theme-matrix .message-button {
    background: #00dd33;
    color: #000000;
}

/* Cyberpunk */
body.theme-cyberpunk .ai-chat-window {
    background: #0a0014;
    border-color: #ff00ff;
}

body.theme-cyberpunk .ai-chat-messages {
    background: #0a0014;
}

body.theme-cyberpunk .ai-chat-header {
    background: linear-gradient(135deg, #1a0a2e 0%, #16213e 100%);
}

body.theme-cyberpunk .message.ai .message-content {
    background: #1f2a4e;
    color: #00ffff;
    box-shadow: 0 2px 8px rgba(255, 0, 255, 0.3);
    border: 1px solid #ff00ff;
}

body.theme-cyberpunk .message.user .message-content {
    background: linear-gradient(135deg, #ff00ff 0%, #00ffff 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(255, 0, 255, 0.4);
}

body.theme-cyberpunk .ai-chat-input {
    background: #0a0014;
    border-color: #ff00ff;
    color: #00ffff;
}

body.theme-cyberpunk .message-button {
    background: linear-gradient(135deg, #ff00ff 0%, #00ffff 100%);
    color: #ffffff;
}

/* League Champions */
body.theme-leagueChampions .ai-chat-window {
    background: #162447;
    border-color: #1b9ce5;
}

body.theme-leagueChampions .ai-chat-messages {
    background: #162447;
}

body.theme-leagueChampions .ai-chat-header {
    background: linear-gradient(135deg, #1b9ce5 0%, #00d9ff 100%);
}

body.theme-leagueChampions .message.ai .message-content {
    background: #254a78;
    color: #e8e8e8;
    box-shadow: 0 2px 8px rgba(27, 156, 229, 0.2);
    border: 1px solid #1b9ce5;
}

body.theme-leagueChampions .message.user .message-content {
    background: #1b9ce5;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(27, 156, 229, 0.3);
}

body.theme-leagueChampions .ai-chat-input {
    background: #162447;
    border-color: #1b9ce5;
    color: #e8e8e8;
}

body.theme-leagueChampions .message-button {
    background: #1b9ce5;
    color: #ffffff;
}

/* League Europe */
body.theme-leagueEurope .ai-chat-window {
    background: #1a1f2e;
    border-color: #ffd700;
}

body.theme-leagueEurope .ai-chat-messages {
    background: #1a1f2e;
}

body.theme-leagueEurope .ai-chat-header {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000000;
}

body.theme-leagueEurope .message.ai .message-content {
    background: #2d3548;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
    border: 1px solid #ffd700;
}

body.theme-leagueEurope .message.user .message-content {
    background: #ffd700;
    color: #000000;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

body.theme-leagueEurope .ai-chat-input {
    background: #1a1f2e;
    border-color: #ffd700;
    color: #ffffff;
}

body.theme-leagueEurope .message-button {
    background: #ffd700;
    color: #000000;
}
