/* Chat Overlay */
.ChatOverlay_wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.ChatOverlay_wrapper.is-open {
    opacity: 1;
    visibility: visible;
}

.ChatOverlay_box {
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(20px);
    overflow: hidden;
}

.ChatOverlay_wrapper.is-open .ChatOverlay_box {
    transform: translateY(0);
}

@media (min-width: 600px) {
    .ChatOverlay_box {
        height: 90vh;
        border-radius: 20px;
    }
}

.ChatOverlay_header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
}

.ChatOverlay_title {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-brand);
    margin: 0;
}

.ChatOverlay_headerLogoGroup {
    display: flex;
    align-items: center;
    gap: 12px;
    /* Matching mobile/small screen gap */
}

.ChatOverlay_logoImg {
    height: 42px;
    /* Increased slightly to feel more balanced */
    width: auto;
}

.ChatOverlay_headerDivider {
    width: 1px;
    height: 24px;
    background-color: #663;
    opacity: 0.5;
}

.ChatOverlay_subTitle {
    font-family: var(--font-notosansjp);
    font-size: 14px;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
    white-space: nowrap;
    letter-spacing: 0.05em;
}

.ChatOverlay_subTitle ruby rt {
    font-size: 0.6em;
    color: #666;
    letter-spacing: 0.1em;
}

/* Mobile adjustments for Header */
@media (max-width: 480px) {
    .ChatOverlay_header {
        padding: 12px 15px;
    }

    .ChatOverlay_headerLogoGroup {
        gap: 8px;
    }

    .ChatOverlay_logoImg {
        height: 32px;
    }

    .ChatOverlay_headerDivider {
        height: 18px;
    }

    .ChatOverlay_subTitle {
        font-size: 11px;
    }
}

.ChatOverlay_close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.ChatOverlay_content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 60px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8fafc;
}

/* Message Bubbles */
.ChatMessage {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    animation: ChatMessage_in 0.25s ease-out;
}

@keyframes ChatMessage_in {
    0% {
        opacity: 0;
        transform: scale(0.98);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.ChatMessageGroup--ai {
    display: flex;
    align-self: flex-start;
    gap: 8px;
    max-width: 90%;
}

.ChatMessage_avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin-top: 4px;
}

.ChatMessage_avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    background: #fff;
}


.ChatMessage--ai {
    background: #fff;
    color: #333;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    max-width: 100%;
}

.ChatMessage--user {
    align-self: flex-end;
    background: var(--color-brand);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ChatMessage_media {
    margin-top: 8px;
    max-width: 100%;
    border-radius: 8px;
    display: block;
}

/* Input Area */
.ChatOverlay_footer {
    padding: 12px 16px 20px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
}

.ChatInput_group {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
    border-radius: 24px;
    padding: 8px 14px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.ChatInput_group:focus-within {
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.ChatInput_textarea {
    width: 100%;
    border: none;
    background: transparent;
    padding: 8px 4px;
    font-size: 16px;
    resize: none;
    max-height: 240px;
    /* 約10行分 */
    outline: none;
    line-height: 1.4;
    color: #1a1a1a;
    overflow-y: auto;
}

.ChatInput_bottomRow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.ChatInput_tools {
    display: flex;
    gap: 4px;
}

.ChatInput_toolBtn {
    color: #64748b;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.ChatInput_toolBtn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.ChatInput_toolBtn.is-active {
    background: #fee2e2;
    border-color: #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.ChatInput_send {
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
    opacity: 0;
    transform: scale(0.8);
}

.ChatInput_send[style*="visible"] {
    transform: scale(1);
}

.ChatInput_send:hover {
    background: #000;
}

.ChatInput_send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ChatInput_finish {
    background: #fff;
    color: #ef4444;
    border: 2px solid #ef4444;
    border-radius: 20px;
    padding: 8px 24px;
    font-weight: bold;
    cursor: pointer;
    height: 40px;
    transition: all 0.2s;
    white-space: nowrap;
}

.ChatInput_finish:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #dc2626;
}

/* Clean Message Container (No Bubble) */
.ChatMessage_clean {
    width: 100%;
    max-width: 100%;
    margin-top: 10px;
    animation: ChatMessage_in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Attribute Form Wizard */
.AttributeForm {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin: 0 auto;
    width: 100%;
    max-width: 400px;
    /* Restrict width on PC */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.AttributeForm_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.AttributeForm_step {
    font-size: 11px;
    font-weight: bold;
    color: var(--color-brand);
    background: #e0f2fe;
    padding: 4px 10px;
    border-radius: 12px;
}

.AttributeForm_close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
}

.AttributeForm_title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 24px;
    color: #1e293b;
    text-align: center;
}

.AttributeForm_subAction {
    margin-top: 16px;
    text-align: center;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
}

.AttributeForm_textBtn {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 14px;
    padding: 10px 24px;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    font-weight: 500;
}

.AttributeForm_textBtn:hover {
    background: #f1f5f9;
    color: #475569;
    border-color: #94a3b8;
}

.AttributeForm_submit {
    background: var(--color-brand);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

.AttributeForm_skip {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.AttributeForm_skip:hover {
    background: #e2e8f0;
    color: #334155;
}

.AttributeForm_title {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #334155;
}

/* Custom Modal */
.ChatModal_wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.ChatModal_wrapper.is-visible {
    opacity: 1;
    visibility: visible;
}

.ChatModal_content {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: scale(0.9);
    transition: all 0.2s;
    position: relative;
}

.ChatModal_content--form {
    max-width: 400px;
    text-align: left;
    padding: 24px;
}

.ChatModal_wrapper.is-visible .ChatModal_content {
    transform: scale(1);
}

.ChatModal_title {
    font-size: 18px;
    font-weight: bold;
    margin: 0 0 12px;
    color: #1a1a1a;
}

.ChatModal_text {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0 0 24px;
}

.ChatModal_actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ChatModal_btn {
    padding: 14px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.ChatModal_btn--confirm {
    background: var(--color-brand);
    color: #fff;
}

.ChatModal_btn--cancel {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.ChatModal_btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.AttributeForm_desc {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 20px;
}

.AttributeForm_intro {
    font-size: 14px;
    color: #1a365d;
    line-height: 1.4;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px dashed #e2e8f0;
    font-weight: 500;
}

.AttributeForm_field {
    margin-bottom: 16px;
}

.AttributeForm_label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.AttributeForm_select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 16px;
    background: #f8fafc;
    color: #1e293b;
    outline: none;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.AttributeForm_select:focus {
    border-color: var(--color-brand);
}

.AttributeForm_actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.AttributeForm_btn {
    flex: 1;
    padding: 12px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.AttributeForm_btn--skip {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
}

.AttributeForm_btn--skip:hover {
    background: #e2e8f0;
}

.AttributeForm_btn--submit {
    background: var(--color-brand);
    border: none;
    color: #fff;
}

.AttributeForm_btn--submit:hover {
    opacity: 0.9;
}

.AttributeForm_done {
    text-align: center;
    padding: 20px;
    color: #059669;
    font-weight: 600;
    font-size: 14px;
}

/* Typing Indicator */
.ChatTyping {
    display: flex;
    gap: 4px;
    padding: 12px 0;
    align-self: flex-start;
    width: fit-content;
    animation: ChatMessage_in 0.25s ease-out;
}

.ChatTyping_dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: ChatTyping_anim 1.2s infinite ease-in-out;
}


@keyframes ChatTyping_anim {
    0% {
        opacity: 0.3;
        transform: scale(0.7);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 0.3;
        transform: scale(0.7);
    }
}

/* Loading Spinner */
.ChatSpinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid var(--color-brand);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Action Area (New Finish Button) */
.ChatFooter_actionArea {
    padding: 0 0 12px;
    text-align: center;
}

.ChatAction_finishBtn {
    display: block;
    width: 100%;
    background: #fff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ChatAction_finishBtn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.ChatAction_note {
    font-size: 11px;
    color: #64748b;
    margin-top: 6px;
    text-align: left;
    line-height: 1.4;
}

/* Summary Confirmation */
.AttributeForm_confirm {
    text-align: left;
}

.AttributeForm_summary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
}

.AttributeForm_summary p {
    margin: 8px 0;
}

.AttributeForm_summary strong {
    color: #0f172a;
    display: inline-block;
    min-width: 80px;
}

/* Visual Stepper */
.AttributeForm_stepper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.AttributeForm_dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: background 0.3s;
}

.AttributeForm_dot.is-active {
    background: var(--color-brand);
}

/* Single Action Layout */
.AttributeForm_actions--single {
    display: flex;
    justify-content: flex-end;
    /* Right align the button */
}

/* Icon Button */
.AttributeForm_submit--icon {
    width: 64px;
    height: 64px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.AttributeForm_submit--last:not(:disabled) {
    background: #15803d !important;
    /* Premium Green (emerald-700) */
}

.AttributeForm_submit--icon:not(:disabled):active {
    transform: scale(0.92);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.1);
}

.AttributeForm_submit--icon svg {
    width: 28px;
    height: 28px;
}

.AttributeForm_submit--icon:disabled,
.AttributeForm_submit--icon.is-disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

/* Transition Buttons (Confirmation inside chat) */
.ChatTransition_buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
    justify-content: center;
    animation: ChatMessage_in 0.4s ease-out;
}

.ChatTransition_btn {
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ChatTransition_btn--survey {
    background: var(--color-brand);
    color: #fff;
}

.ChatTransition_btn--continue {
    background: #fff;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.ChatTransition_btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ChatTransition_btn:active {
    transform: translateY(0);
}

/* Attribute Form Badge */
.AttributeForm_badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
    font-weight: bold;
    text-transform: uppercase;
}