#UpculRAG_AIComponentContainer {
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    background-color: #f9f9f9;
}

.UpculRAG_ContentWrapper {
    display: grid;
    gap: 20px;

    .TitleBox {
        display: grid;
        grid-template-columns: 1fr 30px;
        gap: 10px;

        .Title {
            font-size: 1.5rem;
            color: #333;
        }

        .UpculRAG_ModeChangeButton {
            display: grid;
            line-height: 1;
            place-content: center;
            place-items: center;
            align-self: start;
            justify-self: end;
            background-color: #4756a1;
            border: none;
            padding: 5px;
            border-radius: 5px;    

            &:hover {
                background-color: #2c3c89;
            }

            &:disabled {
                background-color: #ccc;
                cursor: not-allowed;
            }

            .Icon {
                font-size: 20px;
                color: #fff;
            }
        }
    }

    .AnswerBoxWrapper {
        background-color: #dfe4ef;
        border: 1px solid #ccc;
        border-radius: 5px;
        height: fit-content;
        min-height: 150px;
        max-height: 550px;
        
        overflow-x: hidden;
        overflow-y: auto;
    }

    .AnswerBox {
        max-width: 900px;
        margin: 0 auto;

        display: grid;
        gap: 10px;
        align-items: start;
        align-content: start;
        padding: 20px;

        .NoticeContent {
            display: grid;
            gap: 10px;
            justify-items: center;
            border-bottom: 1px solid #ccc;
            
            padding: 10px;
            margin-bottom: 20px;
            width: 100%;
            max-width: 600px;
            justify-self: center;

            .IconContainer {
                width: 70px;
                height: 70px;
                aspect-ratio: 1/1;
                border-radius: 100px;
                border: 2px solid #ccc;
                overflow: hidden;
            }

            .UpculRAGIcon {
                width: 100%;
                height: 100%;
                object-fit: cover;
                object-position: top;
                transform: scale(1.1);
                transform-origin: top;
            }

            .TextContentArea {
                display: grid;
                gap: 10px;
                padding: 10px;
                border-radius: 5px;
                
                .ParagraphBlock {
                    display: grid;

                    .MainText {
                        font-size: 0.9em;
                        font-weight: bold;
                        color: #777;
                    }
                    .SubText {
                        font-size: 0.7em;
                        color: #999;
                    }
                }
            }
        }

        .QuestionContent {
            padding: 20px;
            border-radius: 5px;
            background-color: #fff;
            width: 80%;
            justify-self: end;

            .TextContent {}
        }

        .AnswerContent {
            padding: 20px;
            border-radius: 5px;
            background-color: #ffffff77;
            width: 100%;
            justify-self: start;

            display: grid;
            gap: 10px;
            grid-template-columns: 30px 1fr;

            .IconArea {

                .UpculRAGIcon_Face {
                    width: 30px;
                    height: 30px;
                    border-radius: 100px;
                    border: 1px solid #ccc;
                }
            }

            .LoadingArea {
                display: grid;
                justify-items: center;
                
                .Title {
                    font-size: 1em;
                    color: #777;
                }
                .SubTitle {
                    font-size: 1.1em;
                    font-weight: bold;
                    color: #555;

                    .Divider {
                        font-size: 0.9em;
                        color: #999;
                    }
                }
                .Text {
                    border-top: 1px solid #ccc;
                    font-size: 0.8em;
                    color: #999;
                }
            }

            .ContentArea {
                
                .TextContent {}
            }

            .Hidden {
                display: none;
            }
        }
    }

    .QuestionBox {
        display: grid;
        gap: 10px;

        &.ForNotLoggedIn {
            justify-content: center;
        }

        .Message {
            font-size: 1rem;
            color: #555;
        }
    }

    .Hidden {
        display: none;
    }
}

.UpculRAG-QuestionArea {
    width: 100%;
    padding: 10px;
    resize: none;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.UpculRAG_NewThreadButton {
    font-size: 0.8em;
    padding: 0px 10px;
    background-color: transparent;
    color: #4756a1;
    text-decoration: underline;
    border: none;
    justify-self: end;

    cursor: pointer;

    &:disabled {
        color: #ccc;
        cursor: not-allowed;
    }
}

.UpculRAG_SubmitButton {
    padding: 10px 20px;
    background-color: #4756a1;
    color: #fff;
    border-radius: 5px;
    border: none;
    justify-self: start;

    cursor: pointer;

    &:hover {
        background-color: #2c3c89;
    }

    &:disabled {
        background-color: #ccc;
        cursor: not-allowed;
    }
}

/* Dialogの背景のスクロールを防止するため */
body.UpculRAG_DialogOpen {
    overflow: hidden;
}

#UpculRAG_AIComponentDialog[open] {
    display: block;
    
    /* 開くアニメーション */
    animation: UpculRAG_DialogAnimation .3s ease-in-out;
    /* 開いている状態の透明度 */
    opacity: 1;
}

#UpculRAG_AIComponentDialog {
    all: unset;
    border: none;
    display: none;
    position: fixed;
    inset: 0px;
    padding: 20px;
    background-color: #f9f9f9;
    box-shadow: inset 0px 0px 5px 0px #00000077;

    /* 閉じるアニメーション */
    transition: all .3s allow-discrete;
    /* 閉じている状態の透明度 */
    opacity: 0;

    .UpculRAG_ContentWrapper {
        display: grid;
        grid-template-rows: auto auto 1fr auto;        
        height: 100%;

        .TitleBox {}
        .UpculRAG_NewThreadButton {}
        .AnswerBoxWrapper {
            height: 100%;
            max-height: 100%;

            .AnswerBox {
                
            }
        }
        .QuestionBox {}
    }
}

/* ダイアログ表示アニメーション */
@keyframes UpculRAG_DialogAnimation {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Mobile画面でAnswerBoxWrapperの幅を変更する */
@media screen and (max-width: 768px) {
    .UpculRAG_ContentWrapper {
        .AnswerBoxWrapper {
            margin: 0 -20px;
            border-radius: 0;
            border: none;
            border-top: 1px solid #ccc;
            border-bottom: 1px solid #ccc;
        }
    }
}