@charset "UTF-8";

/* =========================================================
   1. ウィジェット大枠（右下固定）
========================================================= */
.subsidy-bot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.subsidy-bot-widget * {
    box-sizing: border-box;
}

/* =========================================================
   2. 起動ボタン（トグル）
========================================================= */
.subsidy-bot__toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #1e40af;
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.subsidy-bot__toggle-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -3px rgba(30, 64, 175, 0.35);
}

.subsidy-bot__toggle-icon {
    font-size: 16px;
    display: inline-block;
}

/* パネルが開いている時はトグルボタンを隠す */
.subsidy-bot-widget.is-open .subsidy-bot__toggle-btn {
    display: none;
}

/* =========================================================
   3. チャットパネル本体
========================================================= */
.subsidy-bot__panel {
    display: none;
    width: 380px;
    height: 560px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
    background-color: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
    transform-origin: bottom right;
    animation: subsidyWidgetSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    flex-direction: column;
}

.subsidy-bot-widget.is-open .subsidy-bot__panel {
    display: flex;
}

@keyframes subsidyWidgetSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* パネルヘッダー */
.subsidy-bot__header {
    flex-shrink: 0;
    height: 48px;
    background-color: #1e40af;
    color: #ffffff;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subsidy-bot__header-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 0;
}

.subsidy-bot__close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
}

.subsidy-bot__close-btn:hover {
    opacity: 1;
}

/* 会話ウィンドウ */
.subsidy-bot__chat-window {
    flex: 1;
    min-height: 0;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: #f3f4f6;
    scroll-behavior: smooth;
}

/* アクション・ボタンエリア */
.subsidy-bot__action-area {
    flex-shrink: 0;
    max-height: 180px;
    padding: 10px;
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

/* =========================================================
   4. メッセージバブル
========================================================= */
.subsidy-bot__message {
    max-width: 88%;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.subsidy-bot__message--bot {
    align-self: flex-start;
    background-color: #ffffff;
    color: #1f2937;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.subsidy-bot__message--user {
    align-self: flex-end;
    background-color: #1e40af;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

/* =========================================================
   5. 選択肢ボタン
========================================================= */
.subsidy-bot__btn {
    appearance: none;
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-align: left;
}

.subsidy-bot__btn:hover {
    background-color: #1e40af;
    border-color: #1e40af;
    color: #ffffff;
}

/* =========================================================
   6. 診断結果カード
========================================================= */
.subsidy-bot__card {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 10px;
    border-radius: 8px;
    margin: 4px 0;
    width: 100%;
}

.subsidy-bot__card-badge {
    display: inline-block;
    background-color: #15803d;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    margin-bottom: 4px;
}

.subsidy-bot__card-title {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: #14532d;
    font-weight: 700;
}

.subsidy-bot__card-row {
    font-size: 12px;
    margin-bottom: 2px;
    color: #166534;
}

.subsidy-bot__sub-list {
    margin: 6px 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.subsidy-bot__sub-item {
    font-size: 11px;
    color: #4b5563;
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
}

.subsidy-bot__card-notice {
    margin-top: 6px;
    font-size: 10px;
    color: #6b7280;
    line-height: 1.4;
    border-top: 1px dashed #cbd5e1;
    padding-top: 4px;
}

/* =========================================================
   7. 最終CTA / 相談フォーム
========================================================= */
.subsidy-bot__cta-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}

.subsidy-bot__cta-text {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: #1f2937;
    text-align: center;
}

.subsidy-bot__cta-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.subsidy-bot__cta-btn {
    display: block;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    background-color: #ffffff;
    border: 1px solid #94a3b8;
    color: #334155;
    transition: all 0.2s ease;
    cursor: pointer;
}

.subsidy-bot__cta-btn:hover {
    background-color: #f1f5f9;
}

.subsidy-bot__cta-btn--primary {
    background-color: #1e40af;
    color: #ffffff;
    border-color: #1e40af;
}

.subsidy-bot__cta-btn--primary:hover {
    background-color: #1d4ed8;
}

/* 相談フォーム */
.subsidy-bot__form-card {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    margin-top: 6px;
    width: 100%;
}

.subsidy-bot__form-card h4 {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: #1e40af;
}

.subsidy-bot__form-subtitle {
    margin: 0 0 10px 0;
    font-size: 11px;
    color: #64748b;
}

.subsidy-bot__form-group {
    margin-bottom: 8px;
}

.subsidy-bot__form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 2px;
    color: #334155;
}

.subsidy-bot__req {
    color: #ef4444;
}

.subsidy-bot__input,
.subsidy-bot__textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
}

.subsidy-bot__input:focus,
.subsidy-bot__textarea:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 1px #1e40af;
}

.subsidy-bot__submit-btn {
    width: 100%;
    background-color: #1e40af;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 4px;
}

.subsidy-bot__submit-btn:hover {
    background-color: #1d4ed8;
}

.subsidy-bot__submit-btn:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
}

.subsidy-bot__form-error {
    margin-top: 6px;
    font-size: 11px;
    color: #dc2626;
    text-align: center;
}

/* =========================================================
   8. スマートフォン（レスポンシブ）対応
========================================================= */
@media (max-width: 480px) {
    .subsidy-bot-widget {
        bottom: 16px;
        right: 16px;
    }

    .subsidy-bot__panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
    }
}