/* ================================================================
   AI Chat Widget — aichat.css
   ================================================================ */

/* ── コンテナ ──────────────────────────────────────────────────── */
#aichat {
    max-width: 480px;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}

/* ── ログエリア ────────────────────────────────────────────────── */
#aichat-log {
    height: 340px;
    overflow-y: auto;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── メッセージ共通 ────────────────────────────────────────────── */
.aichat-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 16px;
    line-height: 1.6;
    word-break: break-word;
}

/* ── ユーザーメッセージ（右寄せ） ─────────────────────────────── */
.aichat-msg.user {
    background: #0073aa;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* ── AI メッセージ（左寄せ） ──────────────────────────────────── */
.aichat-msg.ai {
    background: #f1f1f1;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* ── 思考中インジケーター ─────────────────────────────────────── */
.aichat-thinking {
    color: #999;
    font-size: 18px;
    letter-spacing: 4px;
    animation: aichat-blink 1.2s ease-in-out infinite;
}

@keyframes aichat-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ── 入力エリア ────────────────────────────────────────────────── */
.aichat-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

#aichat-message {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#aichat-message:focus {
    border-color: #0073aa;
}

/* ── 送信ボタン ────────────────────────────────────────────────── */
#aichat-send {
    padding: 8px 18px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, opacity 0.2s;
}

#aichat-send:hover:not(:disabled) {
    background: #005f8a;
}

/* ── 送信中状態 ────────────────────────────────────────────────── */
#aichat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── CTA ボタン ────────────────────────────────────────────────── */
.aichat-cta {
    display: block;
    margin-top: 4px;
    padding: 10px 16px;
    background: #e65c00;
    color: #fff !important;
    text-align: center;
    border-radius: 8px;
    text-decoration: none !important;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.2s;
    align-self: stretch;
}

.aichat-cta:hover {
    background: #c24e00;
}

/* ── スクロールバー（Webkit） ──────────────────────────────────── */
#aichat-log::-webkit-scrollbar {
    width: 4px;
}
#aichat-log::-webkit-scrollbar-track {
    background: transparent;
}
#aichat-log::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* ── レスポンシブ（狭い画面） ────────────────────────────────── */
@media (max-width: 480px) {
    #aichat {
        max-width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .aichat-msg {
        max-width: 90%;
    }
}