/* AIチャットボット - 新デザインシステム統合版 */

.chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 28, 123, 0.3);
    color: white;
    font-size: 24px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 28, 123, 0.4);
}

.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: var(--color-background);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.chatbot-window.active {
    display: flex;
}

.chatbot-header {
    background: var(--gradient-primary);
    color: white;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.chatbot-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-header .close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.chatbot-header .close-btn:hover {
    opacity: 1;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--color-surface);
}

.message {
    margin-bottom: 16px;
}

.message.user {
    text-align: right;
}

.message.bot {
    text-align: left;
}

.message-content {
    display: inline-block;
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.message.user .message-content {
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.bot .message-content {
    background: white;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    margin-top: 4px;
}

.typing-indicator {
    display: none;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.typing-indicator.active {
    display: block;
}

.typing-dots {
    display: inline-block;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    padding: 12px 16px;
}

.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-light);
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-10px); opacity: 1; }
}

.chatbot-input {
    border-top: 1px solid var(--color-border);
    padding: 16px;
    background: white;
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: 24px;
    font-size: var(--font-size-sm);
    outline: none;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    border-color: var(--color-primary);
}

.input-group button {
    padding: 12px 16px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
}

.input-group button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 28, 123, 0.3);
}

.input-group button:disabled {
    opacity: 0.6;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        height: 60vh;
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
    
    .chatbot-toggle {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
}

/* マークダウンコンテンツスタイリング */
.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 0 0 8px 0;
    font-size: var(--font-size-base);
    font-weight: 600;
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content code {
    background: var(--color-surface);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.message-content strong {
    font-weight: 600;
}

.message-content a {
    color: var(--color-primary);
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}