/*
 * Copyright © 2025 JQIT. All rights reserved.
 */

/* パスワード関連 */
.password-wrapper {
  position: relative;
  width: 100%;
}

.password-wrapper .form-control,
.password-wrapper input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 40px 10px 12px;
  font-size: 16px;
  line-height: 1.2;
}

.toggle-password {
  position: absolute;
  top: 0;
  right: 8px;
  bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  cursor: pointer;
}

.toggle-password .icon {
  width: 20px;
  height: 20px;
  display: block;
  opacity: 0.8;
  transition: opacity .15s ease;
}

.toggle-password:hover .icon {
  opacity: 1;
}

/* サイドバー */
#sidebar {
  background-color: #5BADF0;
}

/* サイドバーのリンク全体 */
.sidebar-link {
  color: white; /* 通常の文字色 */
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}

/* ホバー時 */
.sidebar-link:hover {
  background-color: #138CF0;
  color: #ffffff;
}

/* 現在ページを強調表示 */
.sidebar-link.active {
  color: #003366;
  font-weight: bold;
}

#closeSidebarBtn {
  color: #D1D5DB;
}

#closeSidebarBtn:hover {
  background-color: #138CF0;
  color: #ffffff;
}

/* サイドバー背景オーバーレイ（モバイル用） */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 15; /* サイドバー(z-20)の背面 */
  transition: opacity 0.3s ease;
}

.sidebar-overlay.hidden {
  display: none;
}

/* ===============================================
   モバイル: レイアウト修正
   =============================================== */
@media (max-width: 768px) {
  /* mainをフレックス内で確実にスクロール可能にする */
  #mainContent > main {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6rem;
  }
}

/* ===============================================
   Attendlyヘルプチャット
   =============================================== */
.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
}

.chat-fab {
  width: 52px;
  height: 52px;
  border-radius: 9999px;
  background: linear-gradient(90deg, #5BADF0, #138CF0);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
}
.chat-fab:hover {
  background-color: #138CF0;
}

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #E5E7EB;
}

.chat-panel-header {
  flex: 0 0 auto;
  padding: 12px 14px;
  background: #5BADF0;
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-panel-header button {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #F9FAFB;
}

.chat-row { display: flex; }
.chat-row-user { justify-content: flex-end; }
.chat-row-bot { justify-content: flex-start; }

.chat-bubble {
  max-width: 84%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-row-user .chat-bubble {
  background: #5BADF0;
  color: #ffffff;
  border-bottom-right-radius: 3px;
}
.chat-row-bot .chat-bubble {
  background: #ffffff;
  border: 1px solid #E5E7EB;
  color: #1f2937;
  border-bottom-left-radius: 3px;
}
.chat-bubble.chat-bubble-error {
  background: #FEF2F2;
  border-color: #FCA5A5;
  color: #B91C1C;
}
.chat-source {
  display: block;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #D1D5DB;
  font-size: 11px;
  color: #6B7280;
}

.chat-examples {
  flex: 0 0 auto;
  padding: 0 12px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #F9FAFB;
}
.chat-chip {
  border: 1px solid #D1D5DB;
  background: #ffffff;
  color: #374151;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 9999px;
  cursor: pointer;
}
.chat-chip:hover { border-color: #5BADF0; color: #138CF0; }
.chat-chip:disabled { opacity: .5; cursor: not-allowed; }

.chat-input-row {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #E5E7EB;
  background: #ffffff;
}
#chatInput {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  max-height: 80px;
  font-family: inherit;
}
#chatInput:focus { outline: none; border-color: #5BADF0; }

.chat-send-btn {
  flex: 0 0 auto;
  background: #5BADF0;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 13px;
  cursor: pointer;
}
.chat-send-btn:hover { background-color: #138CF0; }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }

.chat-input-meta {
  flex: 0 0 auto;
  padding: 2px 10px 8px;
  font-size: 10.5px;
  color: #9CA3AF;
  text-align: right;
  background: #ffffff;
}
.chat-input-meta.chat-count-over { color: #DC2626; font-weight: 600; }

@media (max-width: 480px) {
  .chat-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 78px;
  }
  .chat-widget { right: 14px; bottom: 14px; }
}
