/* Reference https://protogram.jp/lesson/javascript-chat-client */

#root {
  /*background-image: url("../../assets/bg.jpg");*/
  background-image: url("../../assets/light_blue_solid_background.png");
  background-size: cover;
  display: flex;
  flex-direction: row;
  justify-content: center;
  height: 100vh;
}

.container {
  display: flex;
  flex-direction: column;
  width: 50%;
  height: 100%;
  background-color: #7993be86;
}

#header {
  position: relative;
  width: 100%;
  height: 48px;
  font-size: 12px;
  text-align: center;
  line-height: 48px;
}

/* ログインボタン・ユーザーボタン */
#login-button,
#user-button {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 14px;
  text-decoration: none;
  background-color: #3f84ef;
  color: #fff;
  padding: 5px 10px;
  border-radius: 5px;
}

.content {
  display: flex;
  width: 100%;
  height: calc(100vh - 96px);
  overflow: hidden;
}

#chat-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px;
  list-style: none;
}

.msg-box {
  display: flex;
  align-items: flex-start;
  margin: 20px 0;
}

.msg-box-user {
  justify-content: flex-end;
  margin-right: 15px;
}

.img-circle {
  width: 50px;
  min-width: 50px;
  height: 50px;
  margin: 0 15px;
  border-radius: 24px;
  background-color: #fff;
}

.msg {
  max-width: 500px;
  padding: 10px;
  border-radius: 10px;
  background: #fff;
}

.msg-user {
  background-color: #63d880;
}

#footer {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  /* 固定高さは削除して、最小高さを設定 */
  min-height: 48px;
  padding: 10px;
}

/* テキストエリアにbox-sizingを指定 */
#msg-input {
  width: 70%;
  margin-right: 10px;
  padding: 5px 15px;
  border: 1px solid #e9e9ed;
  border-radius: 24px;
  background-color: #f6f6f6;
  resize: none;  /* サイズ変更を禁止 */
  box-sizing: border-box;
}

#submit-button {
  padding: 6px 12px;
  border: none;
  border-radius: 5px;
  background-color: #3f84ef;
  color: white;
}

/* ログアウトポップアップ */
#logout-popup {
  position: absolute;
  right: 10px;
  top: 50px;  /* ユーザーボタンの下に表示 */
  z-index: 100;
  /* 幅はボタンの内容に合わせる */
  display: inline-block;
}
/* ログアウトポップアップ内のアカウントメニュー */
#logout-popup .account-menu {
  display: flex;
  flex-direction: column;
  gap: 5px; /* 各ボタン間の隙間 */
}

/* アカウントメニュー内のボタン（「マイ・プロフィール」等）のスタイル */
#logout-popup .account-menu-btn {
  font-size: 14px;
  background-color: #3f84ef;
  color: #fff;
  padding: 5px 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  width: 100%;
}

#mic-button {
  padding: 6px 12px;           /* 送信ボタンと同じパディング */
  border: none;
  border-radius: 5px;
  background-color: #3f84ef;
  color: white;
  margin-right: 10px;          /* 送信ボタンとの隙間を確保 */
}

#mic-button img {
  height: 1em;                 /* テキストサイズに合わせる */
  width: auto;
  vertical-align: middle;      /* 垂直方向中央に配置 */
}

/* ---------- Responsive Design (768px 以下の場合) ---------- */
@media screen and (max-width: 768px) {
  /* ルート要素のレイアウト変更 */
  #root {
    flex-direction: column;
    align-items: center;
  }
  /* コンテナを全幅に */
  .container {
    width: 100%;
    height: 100vh;
    background-color: rgba(121, 147, 190, 0.53);
  }
  /* ヘッダー調整 */
  #header {
    height: 48px;
    line-height: 48px;
    font-size: 14px;
  }
  #login-button,
  #user-button {
    right: 5px;
    top: 5px;
    font-size: 12px;
    padding: 4px 8px;
  }
  /* コンテンツ領域調整：下部に余白を確保 */
  .content {
    height: calc(100vh - 96px);
    margin-bottom: 70px;  /* 固定フッター分の余白 */
  }
  /* 入力フォーム調整 */
  #msg-input {
    width: 70%;
    padding: 5px 10px;
  }
  /* ログアウトポップアップ全体の位置調整 */
  #logout-popup {
    right: 5px;
    top: 50px;  /* 必要に応じて調整 */
    display: inline-block;
  }
  #logout-popup .account-menu-btn {
    font-size: 12px;
    padding: 4px 8px;
  }
  #submit-button {
    padding: 4px 8px;
    font-size: 12px;
  }
  #mic-button {
  padding: 4px 8px;           /* 送信ボタンと同じパディング */
  border: none;
  border-radius: 5px;
  background-color: #3f84ef;
  color: white;
  margin-right: 10px;          /* 送信ボタンとの隙間を確保 */
  }

  #mic-button img {
  height: 1em;                 /* テキストサイズに合わせる */
  width: auto;
  vertical-align: middle;      /* 垂直方向中央に配置 */
  }
  /* チャットメッセージのサイズ調整 */
  .msg {
    max-width: 90%;
    font-size: 14px;
  }
  .msg-box {
    margin: 10px 0;
  }
  .img-circle {
    width: 40px;
    height: 40px;
    margin: 0 10px;
  }
  /* ★ フッターを固定して画面下部から少し上げる ★ */
  /* ★ フッターの位置調整 ★ */
  #footer {
    position: fixed;
    bottom: 10px;  /* 下端から10px上げて表示 */
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 500px;
    z-index: 200;
    background-color: rgba(121, 147, 190, 0.53);
    border-radius: 5px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    /* 高さは内容に合わせて自動調整 */
    min-height: 48px;
    padding: 10px;
  }
}

