.ai-chat_wrap {
    min-height: calc(100vh - 109px);
    display: flex;
    flex-direction: column;
}
@media only screen and (max-width: 428px) {
    .ai-chat_wrap {
        min-height: calc(100vh - 90px);
    }
}

.chat-container {
  /* width: calc(100% - 20px); */
  width: 95%;
  max-width: 780px;
  margin: 10px auto;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  padding: 15px;
  max-height: 80vh;
  overflow-y: auto;
}
#chat-box {
  width: 100%;
}
.message {
  margin: 10px 0;
  display: flex;
}
.user {
  justify-content: flex-end;
}
.user .bubble {
  background-color: #fff;
  color: #333;
  border: 1px solid #ccc;
}

.message.ai {
  display: flex;
  align-items: flex-start;
  width: 100%;
}

.ai-icon {
  margin-right: 10px;
  flex-shrink: 0;
  line-height: 1;
  text-align: center;
  color: #333;
}

.ai-icon span {
  font-size: 12px;
}

.bubble-container {
  max-width: 80%;
}

.ai {
  justify-content: flex-start;
}
.ai .loading {
  background-color: #eef4ff;
  color: #333;
  border: 1px solid #b6d0f5;
  padding: 10px 15px;
  border-radius: 15px;
  max-width: 80%;
  white-space: pre-wrap;
}
.ai .bubble {
  background-color: #eef4ff;
  color: #333;
  border: 1px solid #b6d0f5;
  width: fit-content;
}
.bubble {
  padding: 10px 15px;
  border-radius: 15px;
  max-width: 80%;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.3;
}
.input-area {
  margin-top: 15px;
}

.textarea-wrapper {
  position: relative;
  width: 100%;
}

textarea#user_input {
  width: 100%;
  padding: 10px 40px 10px 10px;
  border: 1px solid #ccc;
  border-radius: 20px;
  resize: none;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.3;
  max-height: 200px;
  box-sizing: border-box;
}


.chat-container input[type="text"] {
  flex: 1;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 20px;
}
.chat-container button {
  background-color: #4285f4;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 20px;
  cursor: pointer;
  margin-top: 5px;
  display: inline-block;
}

.chat-container button.reset-btn {
    background-color: transparent;
    border: 2px solid #434a52;
    color: #434a52;
    padding: 8px 13px;
}

.chat-container a {
  color: #0077cc;
  text-decoration: underline;
}

.bubble.loading::after {
  content: ' ';
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  border: 2px solid #ccc;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

header#masthead {
    margin-top: 0;
}

#sub_header {
    background-color: #1f51a2;
    font-size: 14px;
    line-height:2;
}

.sub_header_con {
    max-width: 960px;
    margin: 0px auto;
    padding: 0px 20px;
    font-size: 13px;
}
.txt-white {
    color: #FFF;
}

@media only screen and (max-width: 428px) {
    header {
        min-height: 0px;/
    }
}

#send {
  position: absolute;
  bottom: 3px;
  right: 10px;
  padding: 6px 10px;
  border: none;
  border-radius: 50%;
  background-color: #4285f4;
  color: white;
  font-size: 14px;
  cursor: pointer;
  z-index: 2;
}

.chat-alert {
  margin-top: 5px;
  font-size: 12px;
  padding-left: 5px;
}

.chat-alert span {
  color: #cc0000;
  font-weight:bold;
}

.chat-count {
  color: #555;
  font-size: 12px;
  margin-right: 10px;
  text-align: right;
}

.ai-chat_footer {
    margin-top: auto;
    padding: 0 10px;
    text-align: right;
    font-size: 12px;
    color: #999;
}

.ai.input-wrapper {
  position: relative;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
}

.ai.input-wrapper textarea {
  width: 100%;
  height: 100px;
  padding: 12px 40px 12px 12px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid #ccc;
  resize: none;
}

.ai.input-wrapper .submit-button {
  position: absolute;
  right: 10px;
  bottom: 15px !important;
  background-color: #ccc;
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: not-allowed;
  transition: background-color 0.3s;
}

.ai.input-wrapper #send{
  background-color: #ccc;
  pointer-events: none;
}

.ai.input-wrapper #send.active {
  background-color: #007bff;
  cursor: pointer;
  pointer-events: auto;
}

.ai.input-wrapper .submit-button::before {
  content: '➤';
  font-size: 16px;
  display: block;
  text-align: center;
}

.ai.input-wrapper .input-area{
  display:flex;
}


/* Favorite modal */
.modal-ai-chat .modal-content {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  width: 100%;
  max-width: 700px;
  border-radius: 10px;
  padding: 15px;
}

.modal-ai-chat .modal-header {
  border-bottom: none;
  font-size: 25px;
  text-align: center;
  color: #000;
  padding: 35px 0 15px;
  position: relative;
}

.modal-ai-chat .modal-header-close {
  max-width: 25px;
  height: auto;
  position: absolute;
  top: 0;
  right: 0;
  margin: 0;
  cursor: pointer;
}

.modal-ai-chat .modal-footer-ttl,
.modal-ai-chat .modal-footer-txt {
  font-weight: 500;
}

.modal-ai-chat .modal-footer-ttl {
  font-size: 16px;
}

.modal-ai-chat .modal-footer-txt {
  font-size: 12px;
}

.modal-ai-chat .modal-bg {
  position: fixed;
  background: rgba(0, 0, 0, 0.7);
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
}
/* End favorite modal */

@media screen and (max-width: 500px) {
  textarea#user_input {
    line-height: 1.1;
  }
  .ai.input-wrapper textarea {
    height: 110px;
  }
  #send {
    bottom: 3px;
    padding: 4px 8px;
  }
  .ai .bubble {
    max-width: 70%;
  }
}

@media screen and (max-width: 370px) {
  .ai.input-wrapper textarea {
    height: 135px;
  }
}

@media screen and (max-width: 350px) {
  .ai.input-wrapper textarea {
    height: 155px;
  }
}