/* チャットボット デモページスタイル */
.demo-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.demo-container h1 {
    font-size: 2.5rem;
    color: #00ff88;
    margin-bottom: 20px;
}

.demo-container p {
    font-size: 1.2rem;
    color: #ccc;
    margin-bottom: 40px;
}

.demo-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 50px;
}

.demo-feature {
    background: #1a1a1a;
    padding: 30px;
    border-radius: 10px;
    border: 1px solid #333;
}

.demo-feature h3 {
    color: #00ff88;
    margin-bottom: 15px;
}

.demo-feature p {
    font-size: 0.95rem;
    color: #ccc;
}

/* チャットボット基本スタイル */
.chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* チャットコンテナ（閉じた状態） */
.chatbot__container {
    background: #1a1a1a;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 350px;
    height: 50px; /* ヘッダーの高さのみ */
}

/* チャットコンテナ（開いた状態） */
.chatbot__container--open {
    height: 550px; /* 全体の高さ */
}

/* チャットボディ（ヘッダー以外の部分） */
.chatbot__body {
    height: calc(100% - 50px); /* ヘッダー分を引いた高さ */
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chatbot__container--open .chatbot__body {
    opacity: 1;
}

/* ヘッダー（常に表示） */
.chatbot__header {
    background: linear-gradient(135deg, #00ff88 0%, #00cc70 100%);
    color: #0a0a0a;
    height: 50px;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.chatbot__header:hover {
    background: linear-gradient(135deg, #00ff99 0%, #00dd80 100%);
}

.chatbot__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    user-select: none;
}

.chatbot__toggle {
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.chatbot__toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* CSS三角形 */
.chatbot__toggle-arrow {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid #0a0a0a;
    transition: transform 0.3s ease;
}

.chatbot__container--open .chatbot__toggle-arrow {
    transform: rotate(180deg);
}

/* 制約説明エリア */
.chatbot__disclaimer {
    background: #2a2a2a;
    padding: 10px 15px;
    border-bottom: 1px solid #333;
    font-size: 12px;
    color: #999;
}

.chatbot__disclaimer p {
    margin: 0;
}

/* メッセージエリア */
.chatbot__messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 既存サイトデザインに合わせたスクロールバー */
.chatbot__messages::-webkit-scrollbar,
.chatbot__options::-webkit-scrollbar {
    width: 8px;
}

.chatbot__messages::-webkit-scrollbar-track,
.chatbot__options::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.chatbot__messages::-webkit-scrollbar-thumb,
.chatbot__options::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00ff88 0%, #00cc70 100%);
    border-radius: 4px;
    opacity: 0.8;
}

.chatbot__messages::-webkit-scrollbar-thumb:hover,
.chatbot__options::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00ff99 0%, #00dd80 100%);
    opacity: 1;
}

/* メッセージバブル */
.chatbot__message {
    max-width: 80%;
    padding: 10px 15px;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
    word-wrap: break-word;
}

.chatbot__message--bot {
    align-self: flex-start;
    background: #333;
    color: #fff;
}

.chatbot__message--user {
    align-self: flex-end;
    background: linear-gradient(135deg, #00ff88 0%, #00cc70 100%);
    color: #0a0a0a;
    font-weight: 500;
}

.chatbot__message-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 5px;
}

/* リンクスタイル */
.chatbot__message a {
    color: #00ff88;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-bottom 0.3s ease;
}

.chatbot__message a:hover {
    border-bottom: 1px solid #00ff88;
}

/* 選択肢ボタン */
.chatbot__options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.chatbot__option-btn {
    background: #2a2a2a;
    border: 1px solid #00ff88;
    color: #00ff88;
    padding: 8px 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    font-size: 13px;
}

.chatbot__option-btn:hover {
    background: #00ff88;
    color: #0a0a0a;
    transform: translateX(5px);
}

/* 入力エリア */
.chatbot__input-area {
    padding: 15px;
    background: #2a2a2a;
    border-top: 1px solid #333;
    display: flex;
    gap: 10px;
}

.chatbot__input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #444;
    color: #fff;
    padding: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.chatbot__input:focus {
    border-color: #00ff88;
}

.chatbot__input::placeholder {
    color: #666;
}

.chatbot__send {
    background: linear-gradient(135deg, #00ff88 0%, #00cc70 100%);
    color: #0a0a0a;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.chatbot__send:hover {
    transform: scale(1.05);
}

.chatbot__send:active {
    transform: scale(0.95);
}

/* タイピングアニメーション */
.chatbot__typing {
    display: flex;
    gap: 4px;
    padding: 10px 15px;
    background: #333;
    align-self: flex-start;
}

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

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

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

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

/* レスポンシブ対応 */
/* タブレット（768px以下） */
@media (max-width: 768px) {
    .chatbot__container {
        width: calc(100vw - 40px);  /* 左右に20pxずつ余白 */
        max-width: 350px;  /* 最大幅を制限 */
    }

    .chatbot__container--open {
        height: 500px;  /* 固定高さに変更 */
    }

    .demo-container h1 {
        font-size: 2rem;
    }

    .demo-features {
        grid-template-columns: 1fr;
    }
}

/* スマートフォン（480px以下） */
@media (max-width: 480px) {
    .chatbot {
        left: 0;
        right: 0;
        bottom: 0;
        padding: 0 10px 10px 10px;  /* 左右と下に余白 */
    }

    .chatbot__container {
        width: 100%;  /* 親要素（.chatbot）の100%幅 */
        max-width: none;  /* 768pxで設定されたmax-widthを無効化 */
        margin: 0 auto;
    }

    .chatbot__container--open {
        height: 550px;  /* 高さを増やす */
    }

    .chatbot__header {
        padding: 0 12px;
    }

    .chatbot__title {
        font-size: 14px;
    }

    .chatbot__input-area {
        padding: 12px;
    }

    .chatbot__input {
        font-size: 14px;
        padding: 8px;
    }

    .chatbot__send {
        padding: 8px 15px;
        font-size: 14px;
    }

    .demo-container {
        padding: 20px 15px;
    }

    .demo-container h1 {
        font-size: 1.5rem;
    }

    .demo-container p {
        font-size: 1rem;
    }

    .demo-features {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .demo-feature {
        padding: 20px;
    }
}

/* 大画面対応（1200px以上） */
@media (min-width: 1200px) {
    .chatbot__container {
        width: 400px;  /* より大きな画面では幅を広く */
    }

    .chatbot__container--open {
        height: 600px;
    }
}

/* ダークテーマ調整 */
@media (prefers-color-scheme: dark) {
    .chatbot__window {
        background: #0a0a0a;
    }

    .chatbot__disclaimer {
        background: #1a1a1a;
    }

    .chatbot__message--bot {
        background: #222;
    }
}