/* 基本スタイル */
body {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 18px;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #333;
}

/* チャット画面全体のコンテナ */
.chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 500px; /* PCでもモバイルのように表示するための最大幅 */
    margin: 0 auto;
    background-color: #f0f2f5; /* チャットの背景色 */
    min-height: 100vh; /* 内容が少なくても画面全体の高さを確保 */
}

/* メッセージが表示されるエリア */
.chat-area {
    max-height: 60vh; /* チャットウィンドウの最大高さを画面の60%に制限 */
    overflow-y: auto; /* 内容が最大高さを超えたらスクロールバーを表示 */
    width: 100%;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-sizing: border-box;
}

.message-wrapper {
    display: flex;
    flex-direction: column; /* 翻訳テキストのためにcolumnに変更 */
    gap: 4px; /* メッセージと翻訳の間のスペース */
}

.message-wrapper.align-right {
    align-items: flex-end; /* 右揃え */
}
.message-wrapper:not(.align-right) {
    align-items: flex-start; /* 左揃え */
}

/* メッセージバブルの共通スタイル */
.message {
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.6;
    font-size: 16px;
    font-weight: 500;
    word-break: break-word; /* 長いテキストの改行 */
}
.message-translation {
    display: block;
    font-size: 14px;
    color: #555;
    font-weight: 500;
    padding: 0 15px;
}

/* AIのメッセージバブル */
.message.assistant {
    background-color: #ffffff;
    border: 1px solid #e9e9eb;
    border-top-left-radius: 4px;
}

/* ユーザーのメッセージバブル */
.message.user {
    background-color: #00a9f7;
    color: white;
    border-top-right-radius: 4px;
}

.message.summary {
    background-color: #f62394; /* 「あなたの好きな本」ボタンと同じ色 */
    color: white;
    border-top-left-radius: 4px;
}

/* 下部の要素が縮まないように設定 */
.mic-button-container,
.input-area,
.iframe-container,
.chat-footer {
    flex-shrink: 0;
}


/* マイクボタン */
.mic-button-container {
    padding: 10px 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.mic-button-text {
    display: flex;
    flex-direction: column;
    margin-top: 5%;
}
.mic-button-text .en {
    font-size: 12px;
    font-weight: normal;
}
.mic-icon {
    width: 28px;
    height: 28px;
}

/* テキスト入力欄 */
.input-area {
    display: flex;
    align-items: flex-end;
    padding: 10px 15px;
    background-color: #f0f2f5;
    border-top: 1px solid #e0e0e0;
}
.text-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 16px;
    margin-right: 10px;
    resize: none;
}

.send-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex; /* // 画像を中央に配置するために追加 */
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.send-button:hover {
    transform: scale(1.1); /* // マウスオーバー時に少し拡大 */
}

.send-button img {
    width: 28px;  /* // 画像の幅を指定 */
    height: 28px; /* // 画像の高さを指定 */
}


/* --- ▼ [追加] キーワード検索エリアのスタイル ▼ --- */

/* キーワードと検索ボタンのエリア全体 */
.keyword-search-area {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
}

/* キーワードボタンを囲むコンテナ */
.keyword-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

/* キーワードボタンの基本スタイル */
.keyword-button {
    flex: 1;
    background-color: #ffffff;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.keyword-button.selected {
    background-color: #007bff;
    color: #ffffff;
    border-color: #007bff;
}

.search-library-button {
    border: none;
    cursor: pointer;
    width: 100%;
}
.search-library-button-img {
    width: 100%;
}

/* --- ▲ [追加] スタイルここまで ▲ --- */


/* 下部フッターボタンのエリア */
.chat-footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 15px 10px;
    background-color: #f0f2f5;
    border-top: 1px solid #e0e0e0;
    gap: 10px;
}

/* 下部フッターボタンの個別スタイル */
.footer-button {
    flex: 1;
    background-color: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-button:hover {
    transform: scale(1.05); /* // マウスオーバー時に少し拡大 */
}

 /*フッターボタン内の画像のスタイル*/
.footer-button img {
    height: 70px;  /*画像の高さを指定（必要に応じて調整）*/
    width: auto;
}

.footer-button.favorite:disabled img {
    cursor: not-allowed; /* 画像の上でもカーソルを変更 */
}

/* iframeを囲むコンテナ */
.iframe-container {
    width: 100%;
    height: 600px;
    padding: 10px;
    box-sizing: border-box; /* パディングをサイズに含める */
    background-color: #f0f2f5; /* チャットウィンドウの背景色と統一 */
}

/* iframeの基本スタイル */
.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: 1px solid #ddd; /* 境界線が必要な場合 */
    border-radius: 8px;   /* 角を丸くする */
}

@media (max-width: 450px) {
    .chat-container{
        max-width: 100%;
    }

    .footer-button img {
    height: 60px;  /*画像の高さを指定（必要に応じて調整）*/
    width: auto;
    }
     .search-library-button{
        font-size: 13px;
    }
}

@media (max-width: 400px) {
    .footer-button img{
        height: 50px;
    }
}

@media (min-width: 401px) and (max-width: 450px) {
    .footer-button img{
        height: 60px;
    }
}

@media (min-width: 720px) {
    .mic-button-text {
    margin-bottom: 5%;
    }
}

/* --- ▼ [修正] 要約モーダルのためのCSS ▼ --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 2000;
}

.modal-overlay.visible {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    position: relative;
    background-color: white;
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 2001;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.info-text-container {
    flex: 1;
    overflow-y: auto;
    overflow-wrap: break-word;
}

.summary-modal-content {
    text-align: left;
}

.summary-scroll {
    flex: 1;
    overflow-y: auto;
}



.modal-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 30px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    background: none;
    border: none;
    padding: 10px;
}
.modal-close-button:hover {
    color: #333;
}

.summary-text-container {
    margin-top: 20px;
    font-size: 16px;
    line-height: 1.7;
    white-space: pre-wrap;
}
.info-text-container {
    margin-top: 20px;
    font-size: 16px;
    line-height: 1.8;
}
.info-text-container p {
    margin: 8px 0;
}

.modal-close-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    cursor: pointer;
    background: none;
    border: none;
}

/* --- ▼ [追加] 権限案内モーダルのためのCSS ▼ --- */

.permission-modal-content {
    text-align: center;
}

.permission-guide-container {
    margin: 20px 0;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 8px;
    text-align: left;
    font-size: 15px;
    line-height: 1.7;
}
.permission-guide-container ol {
    padding-left: 20px;
}

.permission-modal-button {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}
/* --- ▲ 追加ここまで ▲ --- */

/* .mic-button.recording,
.multilingual-button.recording {
  background-color: #D93025;
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(217, 48, 37, 0.3);
} */

.mic-button,
.multilingual-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;

  /* SVG 크기에 맞게 버튼 크기 조정 (필요시) */
  /* width: 226px; */
}

.mic-button img,
.multilingual-button img {
  width: 100%;
  height: auto;
  display: block;
}
