.header {
  background-color: #333;
  color: #fff;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

/* Resize and align logo image */
.logo-img {
  max-height: 50px;
  margin-right: 10px;
}

/* Color and style of button */
.btn-header {
  background-color: #dc3545;
  border-color: #dc3545;
  font-size: 18px;
  font-weight: bold;
  padding: 10px 20px;
}

/* Style the left sidebar */
.sidebar {
  background-color: #f2f2f2;
  height: calc(100vh - 70px);
  width: 100%;
  padding-top: 20px;
}

/* Style the autocomplete input and select dropdown */
.autocomplete,
.select {
  margin-bottom: 10px;
}

/* Style the chat content */
.chat-content {
  width: 100%;
  padding: 20px;
}

/* Style the loading spinner */
.spinner-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  display: none;
}

.spinner-grow {
  margin: 5px;
}

.show-spinner {
  opacity: 1 !important;
  display: flex !important;
}
.coach-avatar {
  border-radius: 50%;
  width: 50px;
  height: 50px;
}

.dot-typing {
  position: relative;
  left: -9999px;
  width: 7px;
  height: 7px;
  border-radius: 5px;
  color: #9880ff;
  box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  animation: dot-typing 1.5s infinite linear;
}

@keyframes dot-typing {
  0% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff,
      10014px 0 0 0 #9880ff;
  }
  16.667% {
    box-shadow: 9984px -10px 0 0 #9880ff, 9999px 0 0 0 #9880ff,
      10014px 0 0 0 #9880ff;
  }
  33.333% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff,
      10014px 0 0 0 #9880ff;
  }
  50% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px -10px 0 0 #9880ff,
      10014px 0 0 0 #9880ff;
  }
  66.667% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff,
      10014px 0 0 0 #9880ff;
  }
  83.333% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff,
      10014px -10px 0 0 #9880ff;
  }
  100% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff,
      10014px 0 0 0 #9880ff;
  }
}

.chat-page-box {
  border: 1px solid gray;
  border-radius: 7px;
  padding: 15px;
  height: calc(100vh - 300px);
  overflow-y: scroll;
}

.history-chat-page-box {
  border: 1px solid gray;
  border-radius: 7px;
  padding: 15px;
  height: calc(100vh - 220px);
  overflow-y: scroll;
}

.chat-block {
  border-radius: 5px;
  border: 1px solid rgb(163, 163, 163);
}

.chat-block-header {
  padding: 5px 10px;
  border-bottom: 1px solid gray;
  background-color: #ccccccf0;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  font-size: 12px;
  font-weight: bold;
}
.chat-block-content {
  padding: 10px;
}

.chat-type-me {
  margin-top: 0px;
  background-color: #fffffff0;
}
.chat-type-me > .chat-block-header {
  display: none;
}

.chat-type-gpt {
  margin-top: 5px;
  margin-bottom: 30px;
  background-color: #e9e9e9f0;
  box-shadow: 0px 1px 3px 3px rgb(204, 204, 204);
}

.chat-user-avatar {
  font-size: 20px;
  margin-right: 10px;
  border-radius: 50%;
  width: 30px;
  height: 30px;
}

.menu-sub-item {
  padding-left: 10px;
}


.pac-container {
  background-color: #FFF;
  z-index: 20;
  position: fixed;
  display: inline-block;
}
.modal{
  z-index: 20;   
}
.modal-backdrop{
  z-index: 10;        
}

/* Mobile responsive: page and layout */
@media (max-width: 767px) {
  .header {
    flex-wrap: wrap;
    height: auto;
    min-height: 70px;
    padding: 10px 8px;
  }
  .header .col {
    flex: 0 0 auto;
    max-width: none;
  }
  .sidebar-selector .form-control,
  .sidebar-selector select {
    max-width: 100% !important;
  }
  .chat-content {
    padding: 12px 10px;
  }
  .chat-page-box,
  .history-chat-page-box {
    height: calc(100vh - 320px);
    min-height: 200px;
    padding: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .chat-block-content {
    padding: 8px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .chat-block-content iframe {
    max-width: 100% !important;
    width: 100% !important;
    min-height: 55vh;
  }
  .chat-block-header .row .col:last-child {
    flex: 0 0 auto;
  }
  .chat-block-header .btn-sm {
    padding: 4px 8px;
    font-size: 12px;
  }
  .container {
    max-width: 100%;
    padding-left: 8px;
    padding-right: 8px;
  }
  #message-input {
    box-sizing: border-box;
  }
}

/* Answer content wrapper: prevent horizontal overflow */
.chat-block-content {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}
.chat-block-content iframe {
  max-width: 100%;
  min-height: 200px;
}
@media (max-width: 767px) {
  .chat-block-content iframe {
    min-height: 55vh;
  }
}

/* AI response as link (WebView / in-app): open in system browser */
.ai-response-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #1890ff;
  color: #fff !important;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.ai-response-link:hover,
.ai-response-link:focus {
  background: #0d7de0;
  color: #fff;
  text-decoration: none;
}
.ai-response-link:active {
  opacity: 0.9;
}