/**
 * Claude Chatbot - Стили
 *
 * Современный дизайн чат-бота в стиле Claude
 */

/* ==================== Основной контейнер ==================== */
#claude-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#claude-chatbot-container.position-left {
    left: 20px;
    right: auto;
}

/* ==================== Кнопка переключения чата ==================== */
.claude-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #6366f1;
    border: none;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.claude-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.claude-chatbot-toggle.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.claude-chatbot-toggle svg {
    width: 28px;
    height: 28px;
}

.claude-chatbot-toggle-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* ==================== Окно чата ==================== */
.claude-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

#claude-chatbot-container.position-left .claude-chatbot-window {
    left: 0;
    right: auto;
}

.claude-chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ==================== Шапка чата ==================== */
.claude-chatbot-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.claude-chatbot-header-info h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
}

.claude-chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
}

.claude-chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.claude-chatbot-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.claude-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== Контейнер сообщений ==================== */
.claude-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.claude-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.claude-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.claude-chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.claude-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ==================== Сообщения ==================== */
.claude-chatbot-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    animation: messageSlideIn 0.3s ease;
}

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

.claude-chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 4px;
}

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

/* Сообщения пользователя */
.claude-chatbot-message-user {
    justify-content: flex-end;
}

.claude-chatbot-message-user .claude-chatbot-message-content {
    background: #6366f1;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Сообщения ассистента */
.claude-chatbot-message-assistant {
    justify-content: flex-start;
}

.claude-chatbot-message-assistant .claude-chatbot-message-content {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

/* Сообщения об ошибках */
.claude-chatbot-message-error .claude-chatbot-message-content {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* ==================== Индикатор загрузки ==================== */
.claude-chatbot-loading {
    padding: 0 20px 12px 20px;
    background: #f9fafb;
}

.claude-chatbot-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    width: fit-content;
    border-bottom-left-radius: 4px;
}

.claude-chatbot-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.claude-chatbot-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.claude-chatbot-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ==================== Область ввода ==================== */
.claude-chatbot-input-container {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    align-items: flex-end;
}

.claude-chatbot-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
    min-height: 44px;
    max-height: 120px;
    overflow-y: auto;
}

.claude-chatbot-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.claude-chatbot-input::placeholder {
    color: #9ca3af;
}

.claude-chatbot-send {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: #6366f1;
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.claude-chatbot-send:hover {
    background: #4f46e5;
    transform: scale(1.05);
}

.claude-chatbot-send:active {
    transform: scale(0.95);
}

.claude-chatbot-send svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
}

/* ==================== Адаптивность ==================== */
@media (max-width: 768px) {
    #claude-chatbot-container {
        bottom: 0;
        right: 0;
        left: 0;
    }

    .claude-chatbot-toggle {
        position: fixed;
        bottom: 20px;
        right: 20px;
    }

    .claude-chatbot-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .claude-chatbot-window.open {
        transform: translateY(0);
    }

    .claude-chatbot-header {
        border-radius: 0;
    }

    .claude-chatbot-message-content {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .claude-chatbot-toggle {
        width: 56px;
        height: 56px;
    }

    .claude-chatbot-toggle svg {
        width: 24px;
        height: 24px;
    }

    .claude-chatbot-message-content {
        font-size: 13px;
        padding: 10px 14px;
    }

    .claude-chatbot-input {
        font-size: 13px;
    }
}

/* ==================== Accessibility ==================== */
.claude-chatbot-toggle:focus,
.claude-chatbot-close:focus,
.claude-chatbot-send:focus,
.claude-chatbot-input:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* ==================== Дополнительные стили ==================== */
.claude-chatbot-window * {
    box-sizing: border-box;
}

/* ==================== Форматирование контента ==================== */
.claude-chatbot-message-content p {
    margin: 0 0 8px 0;
}

.claude-chatbot-message-content p:last-child {
    margin-bottom: 0;
}

.claude-chatbot-message-content a {
    color: #6366f1;
    text-decoration: underline;
}

.claude-chatbot-message-content a:hover {
    color: #4f46e5;
}

.claude-chatbot-message-content strong,
.claude-chatbot-message-content b {
    font-weight: 600;
}

.claude-chatbot-message-content em,
.claude-chatbot-message-content i {
    font-style: italic;
}

.claude-chatbot-message-content code {
    background: #f3f4f6;
    color: #dc2626;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.claude-chatbot-message-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.claude-chatbot-message-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.claude-chatbot-message-content ul,
.claude-chatbot-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.claude-chatbot-message-content li {
    margin: 4px 0;
}

.claude-chatbot-message-content h1,
.claude-chatbot-message-content h2,
.claude-chatbot-message-content h3,
.claude-chatbot-message-content h4 {
    margin: 12px 0 8px 0;
    font-weight: 600;
}

.claude-chatbot-message-content h1 {
    font-size: 1.25em;
}

.claude-chatbot-message-content h2 {
    font-size: 1.15em;
}

.claude-chatbot-message-content h3 {
    font-size: 1.1em;
}

.claude-chatbot-message-content h4 {
    font-size: 1em;
}

.claude-chatbot-message-content blockquote {
    border-left: 3px solid #d1d5db;
    padding-left: 12px;
    margin: 8px 0;
    color: #6b7280;
}

.claude-chatbot-message-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 12px 0;
}

.claude-chatbot-message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}

.claude-chatbot-message-content th,
.claude-chatbot-message-content td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: left;
}

.claude-chatbot-message-content th {
    background: #f9fafb;
    font-weight: 600;
}
