/* FAQチャットボット */
#iwai-faq-chatbot {
    max-width: 500px;
    margin: 20px auto;
    font-family: inherit;
}

/* チャットウィンドウ */
.faq-chat-window {
    border: 2px solid #4caf50;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    background: #fff;
}

/* ヘッダー */
.faq-chat-header {
    background: #4caf50;
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.faq-header-icon {
    width: 40px !important;
    max-width: 40px !important;
    height: auto !important;
    border-radius: 50%;
    background: #fff;
    padding: 3px;
}

.faq-header-title {
    display: block;
    font-size: 16px;
    font-weight: bold;
}

.faq-header-sub {
    display: block;
    font-size: 12px;
    opacity: 0.9;
}

/* チャット本文 */
.faq-chat-body {
    height: 380px;
    overflow-y: auto;
    padding: 16px;
    background: #f5f5f5;
}

/* メッセージ */
.faq-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
}

.faq-msg-user {
    flex-direction: row-reverse;
}

.faq-msg-icon {
    width: 36px !important;
    max-width: 36px !important;
    height: auto !important;
    flex-shrink: 0;
    margin-top: 2px;
}

.faq-msg-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
}

.faq-msg-bot .faq-msg-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 16px 16px 16px 4px;
}

.faq-msg-user .faq-msg-bubble {
    background: #4caf50;
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}

.faq-msg-bubble a {
    color: #0073aa;
    text-decoration: underline;
}

.faq-msg-user .faq-msg-bubble a {
    color: #c8e6c9;
}

/* タイピングアニメーション */
.faq-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.faq-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: faq-bounce 1.2s infinite;
}

.faq-typing span:nth-child(2) { animation-delay: 0.2s; }
.faq-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes faq-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* 入力エリア */
.faq-chat-input-area {
    display: flex;
    padding: 12px;
    gap: 8px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

#faq-chat-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
}

#faq-chat-input:focus {
    border-color: #4caf50;
}

#faq-chat-send {
    padding: 10px 20px;
    font-size: 14px;
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
}

#faq-chat-send:hover { background: #388e3c; }
#faq-chat-send:disabled { background: #999; cursor: not-allowed; }

/* フッター（お問い合わせボタン） */
.faq-chat-footer {
    padding: 10px 12px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    text-align: center;
}

#faq-chat-contact-btn {
    background: none;
    border: 1px solid #ff9800;
    color: #ff9800;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

#faq-chat-contact-btn:hover {
    background: #ff9800;
    color: #fff;
}

/* お問い合わせオーバーレイ */
#faq-contact-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.faq-contact-form {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    width: 90%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.faq-contact-form h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #333;
}

.faq-contact-form p {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #777;
}

.faq-cf-field {
    margin-bottom: 12px;
}

.faq-cf-field label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.faq-req {
    color: #e53935;
    font-size: 11px;
    font-weight: normal;
}

.faq-cf-field input,
.faq-cf-field textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
}

.faq-cf-field input:focus,
.faq-cf-field textarea:focus {
    border-color: #ff9800;
}

.faq-cf-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

#faq-cf-submit {
    flex: 1;
    padding: 12px;
    background: #ff9800;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

#faq-cf-submit:hover { background: #f57c00; }
#faq-cf-submit:disabled { background: #999; }

#faq-cf-cancel {
    padding: 12px 20px;
    background: #eee;
    color: #555;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}

#faq-cf-cancel:hover { background: #ddd; }

/* レスポンシブ */
@media (max-width: 520px) {
    #iwai-faq-chatbot {
        margin: 10px;
    }
    .faq-chat-body {
        height: 300px;
    }
}

/* ========================================
   常駐ウィジェット
   ======================================== */

/* フローティングボタン */
#iwai-faq-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99990;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #4caf50;
    color: #fff;
    padding: 12px 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 15px;
    font-weight: bold;
}

#iwai-faq-widget-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

#iwai-faq-widget-btn img {
    width: 36px !important;
    max-width: 36px !important;
    height: auto !important;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
}

/* ウィジェットパネル */
#iwai-faq-widget-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99991;
    display: flex;
}

.iwai-faq-widget-mode {
    max-width: 380px !important;
    width: 380px;
    margin: 0 !important;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    border-radius: 16px;
    overflow: hidden;
}

.iwai-faq-widget-mode .faq-chat-window {
    border-radius: 16px;
}

.iwai-faq-widget-mode .faq-chat-body {
    height: 350px;
}

@media (max-width: 420px) {
    #iwai-faq-widget-panel {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        align-items: flex-end;
    }
    .iwai-faq-widget-mode {
        width: 100%;
        max-width: 100% !important;
        border-radius: 0;
    }
    .iwai-faq-widget-mode .faq-chat-window {
        border-radius: 0;
    }
    .iwai-faq-widget-mode .faq-chat-body {
        height: calc(100vh - 200px);
    }
}
