/**
 * チャットボットスタイル
 */

/* チャットボタン（固定） */
.tobeshin-chatbot-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    min-width: 200px;
    height: 56px;
    background: #ff6900;
    border-radius: 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: none;
    padding: 0 20px;
}

.tobeshin-chatbot-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    background: #e55a00;
}

.tobeshin-chatbot-button__icon {
    width: 36px;
    height: 36px;
    fill: #fff;
    flex-shrink: 0;
}

.tobeshin-chatbot-button__text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    line-height: 1.2;
    text-align: center;
}

.tobeshin-chatbot-button__text-main {
    font-size: 24px;
    font-weight: 700;
    white-space: nowrap;
}

.tobeshin-chatbot-button__text-sub {
    font-size: 19.5px;
    font-weight: 500;
    white-space: nowrap;
}

.tobeshin-chatbot-button.is-open {
    background: #f44336;
}

.tobeshin-chatbot-button.is-open:hover {
    background: #d32f2f;
}

/* チャットモーダル */
.tobeshin-chatbot-modal {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 90%;
    max-width: 420px;
    max-height: 80vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.tobeshin-chatbot-modal.is-open {
    display: flex;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .tobeshin-chatbot-modal {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 16px 16px 0 0;
    }
}

/* ヘッダー */
.tobeshin-chatbot-header {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.tobeshin-chatbot-header__title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.tobeshin-chatbot-header__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.tobeshin-chatbot-header__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 進捗バー */
.tobeshin-chatbot-progress {
    background: #f5f5f5;
    padding: 12px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.tobeshin-chatbot-progress__bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.tobeshin-chatbot-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    transition: width 0.3s ease;
    border-radius: 3px;
}

.tobeshin-chatbot-progress__text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.tobeshin-chatbot-progress__percent {
    font-weight: 700;
    color: #4CAF50;
}

.tobeshin-chatbot-progress__message {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* チャットコンテナ */
.tobeshin-chatbot-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

.tobeshin-chatbot-container::-webkit-scrollbar {
    width: 6px;
}

.tobeshin-chatbot-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.tobeshin-chatbot-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* メッセージ */
.tobeshin-chatbot-message {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.tobeshin-chatbot-message--bot {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.tobeshin-chatbot-message--user {
    display: flex;
    justify-content: flex-end;
}

.tobeshin-chatbot-message__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #4CAF50;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.tobeshin-chatbot-message__bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.tobeshin-chatbot-message--bot .tobeshin-chatbot-message__bubble {
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #333;
}

.tobeshin-chatbot-message--user .tobeshin-chatbot-message__bubble {
    background: #4CAF50;
    color: #fff;
}

/* 質問タイトル */
.tobeshin-chatbot-question {
    font-weight: 700;
    margin-bottom: 8px;
    color: #333;
}

/* 選択肢 */
.tobeshin-chatbot-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.tobeshin-chatbot-option {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    text-align: left;
    color: #333;
}

.tobeshin-chatbot-option:hover {
    border-color: #4CAF50;
    background: #f0f8f0;
    transform: translateX(4px);
}

.tobeshin-chatbot-option:active {
    transform: translateX(2px);
}

.tobeshin-chatbot-option.is-selected {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
}

/* チェックボックス（複数選択） */
.tobeshin-chatbot-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.tobeshin-chatbot-checkbox:hover {
    background: #f5f5f5;
}

.tobeshin-chatbot-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.tobeshin-chatbot-checkbox label {
    cursor: pointer;
    flex: 1;
    font-size: 14px;
}

/* フォーム入力 */
.tobeshin-chatbot-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tobeshin-chatbot-form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tobeshin-chatbot-form__label {
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.tobeshin-chatbot-form__label .required {
    color: #f44336;
    margin-left: 4px;
}

.tobeshin-chatbot-form__input {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

/* パルスアニメーション（オレンジ系）- 現在の入力欄のみ */
.tobeshin-chatbot-form__input.needs-attention {
    animation: chatbotInputPulseOrange 1.5s ease-in-out infinite;
}

/* パルスアニメーション（オレンジ系）- 強化版 */
@keyframes chatbotInputPulseOrange {
    0%, 100% {
        border-color: #ff6900;
        box-shadow: 0 0 0 0 rgba(255, 105, 0, 0.6);
        background-color: white;
    }
    50% {
        border-color: #ff8800;
        box-shadow: 0 0 0 8px rgba(255, 105, 0, 0.5), 0 0 0 12px rgba(255, 105, 0, 0.3);
        background-color: #fff8f0;
    }
}

.tobeshin-chatbot-form__input:focus {
    outline: none;
    border-color: #4CAF50;
    animation: none;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.tobeshin-chatbot-form__input.is-error {
    border-color: #f44336;
    animation: chatbotInputPulseError 1.5s ease-in-out infinite;
}

/* エラー時のパルスアニメーション - 赤色（エラー時のみ） */
@keyframes chatbotInputPulseError {
    0%, 100% {
        border-color: #f44336;
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
        background-color: white;
    }
    50% {
        border-color: #ff0000;
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0.6), 0 0 0 16px rgba(255, 0, 0, 0.4);
        background-color: #ffe5e5;
    }
}

.tobeshin-chatbot-form__textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

/* パルスアニメーション（オレンジ系）- 現在の入力欄のみ */
.tobeshin-chatbot-form__textarea.needs-attention {
    animation: chatbotInputPulseOrange 1.5s ease-in-out infinite;
}

.tobeshin-chatbot-form__textarea:focus {
    animation: none;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.tobeshin-chatbot-form__textarea.is-error {
    animation: chatbotInputPulseError 1.5s ease-in-out infinite;
}

.tobeshin-chatbot-form__error {
    font-size: 12px;
    color: #f44336;
    display: none;
}

.tobeshin-chatbot-form__error.is-visible {
    display: block;
}

/* 送信ボタン */
.tobeshin-chatbot-submit {
    background: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.tobeshin-chatbot-submit:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.tobeshin-chatbot-submit:active {
    transform: translateY(0);
}

.tobeshin-chatbot-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 完了メッセージ */
.tobeshin-chatbot-complete {
    text-align: center;
    padding: 24px;
}

.tobeshin-chatbot-complete__icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.tobeshin-chatbot-complete__title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.tobeshin-chatbot-complete__message {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* ローディング */
.tobeshin-chatbot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 8px;
}

.tobeshin-chatbot-loading__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    animation: loading 1.4s infinite;
}

.tobeshin-chatbot-loading__dot:nth-child(2) {
    animation-delay: 0.2s;
}

.tobeshin-chatbot-loading__dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* オーバーレイ */
.tobeshin-chatbot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9997;
    display: none;
}

.tobeshin-chatbot-overlay.is-open {
    display: block;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .tobeshin-chatbot-button {
        bottom: 15px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        min-width: 180px;
        height: 52px;
        padding: 0 16px;
    }

    .tobeshin-chatbot-button:hover {
        transform: translateX(-50%) translateY(-2px);
    }

    .tobeshin-chatbot-button__text-main {
        font-size: 21px;
    }

    .tobeshin-chatbot-button__text-sub {
        font-size: 16.5px;
    }

    .tobeshin-chatbot-message__bubble {
        max-width: 85%;
        font-size: 13px;
    }

    .tobeshin-chatbot-option {
        font-size: 13px;
        padding: 10px 14px;
    }
}

