/* 
 * Consolidated components.css
 * Contains all UI component styles including buttons, inputs, messages, feedback, etc.
 */

/* ====== NOTIFICATION & ERROR STYLES ====== */
.rate-limit-error .msg-bubble {
  background-color: #FDEEF0;
  border: 1px solid #F9D2DA;
}

.error-message {
  color: #CC071E;
  font-weight: 500;
}

.error-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #f8d7da;
  color: #721c24;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  max-width: 90%;
  z-index: 1000;
  animation: slideDown 0.3s forwards;
}

.error-content {
  display: flex;
  align-items: center;
}

.error-icon {
  margin-right: 10px;
}

.error-close {
  background: transparent;
  border: none;
  color: #721c24;
  cursor: pointer;
  font-size: 1.2rem;
  margin-left: 15px;
}

.fade-out {
  animation: fadeOut 0.5s forwards;
}

.flash-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #D85C41;
  color: white;
  padding: 15px 30px;
  border-radius: 4px;
  z-index: 1000;
  animation: fadeInOut 3s ease-in-out;
}

/* ====== BUTTON STYLES ====== */
button {
  font-weight: bold;
  border: none;
  background-color: var(--send-button-bg);
  border-radius: 8px;
}

button:hover {
  cursor: pointer;
  background: var(--assistant-msg-bg);
}

.btn-primary {
  background-color: #00549F;
  border-color: #00549F;
}

.btn-primary:hover {
  background-color: #003d75;
  border-color: #003d75;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 84, 159, 0.2);
}

.support-btn {
  border: 2px;
  cursor: pointer;
  color: var(--blue);
  border-radius: 5px;
  background-color: #E8F1FA;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: bold;
  margin-left: 5px;
  height: 29px;
}

.support-btn:hover {
  background: var(--assistant-msg-bg);
}

.action-btn, .close-btn {
  width: 27px;
  height: 27px;
  border: none;
  cursor: pointer;
  align-items: center;
  vertical-align: middle;
  color: var(--blue);
  border-radius: 5px;
  background-color: white;
  justify-content: flex-end;
}

.close-btn {
  height: 29px;
  width: 29px;
  align-items: center;
}

.action-btn:hover, .close-btn:hover {
  background: var(--assistant-msg-bg);
}

.msger-send-btn {
  background-color: var(--rwth-blue) !important; /* Use the same color as header */
  color: var(--blue) !important; /* Using the blue text color from variables.css */
  border: none;
  border-radius: 50% !important;
  width: 50px !important;
  height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1) !important;
  transition: all 0.3s ease !important;
  margin-left: 15px !important;
}

.msger-send-btn:hover {
  background-color: #003d75 !important; /* Keep the hover color as is */
  transform: translateY(-2px) scale(1.05) !important;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15) !important;
  color: white !important; /* Text color changes to white on hover */
}

.msger-send-btn svg {
  width: 22px !important;
  height: 22px !important;
}

.msger-send-btn:active {
  transform: scale(0.98);
}

.msger-send-btn:disabled {
  background-color: #CFD1D2 !important;
  opacity: 0.7;
  cursor: not-allowed;
  color: #666 !important;
}
/* Updated feedback buttons with specific color filter */
.msg-feedback {
  display: flex;
  justify-content: flex-end;
  
  gap: 3px; /* Reduced spacing between buttons */
}

.message-feedback-button-positive,
.message-feedback-button-negative {
  background: none;
  border: none;
  padding: 3px;
  opacity: 0.6;
  color: #333;
  transition: all 0.2s;
  border-radius: 50%;
  font-size: 1.2em;
  cursor: pointer;
}

/* Apply the filter to the button images */
.message-feedback-button-positive img,
.message-feedback-button-negative img {
  width: 16px;
  height: 16px;
  filter: opacity(0.6);
  transition: all 0.2s;
}

/* Hover and active state with the specified color */
.message-feedback-button-positive:hover img,
.message-feedback-button-negative:hover img,
.message-feedback-button-positive.active img,
.message-feedback-button-negative.active img {
  filter: invert(24%) sepia(7%) saturate(5028%) hue-rotate(170deg) brightness(104%) contrast(81%);
  opacity: 1;
}

/* Button hover and active states */
.message-feedback-button-positive:hover,
.message-feedback-button-positive.active,
.message-feedback-button-negative:hover,
.message-feedback-button-negative.active {
  opacity: 1;
  transform: scale(1.2);
  color: transparent; /* Make the button text transparent */
  background-color: transparent;
}

/* Chat button */
#chat_now {
  position: fixed;
  bottom: 16px;
  right: 16px;
  padding: 12px 18px;
  font-size: 16px;
  background-color: var(--rwth-blue);
  color: var(--text-color);
  border: none;
  border-radius: 25px;
  cursor: pointer;
  z-index: 1002;
  transition: background-color 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

#chat_now:hover {
  background-color: #00549F;
  color: white;
}

/* ====== INPUT STYLES ====== */
/* Input area styles to be updated in components.css */

/* ====== INPUT STYLES ====== */
.msger-input {
  font-family: Arial, Helvetica, sans-serif;
  flex: 1;
  background-color: var(--input-bg);
  border-radius: 20px !important;
  border: none !important;
  padding: 12px 18px !important;
  font-size: 15px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  outline: none;
  resize: none;
  overflow-y: auto;
  min-height: 20px;
  max-height: 150px;
  line-height: 1.4;
  margin-right: 10px;
  transition: height 0.2s ease;
  width: 100%;
}

.msger-input:focus {
  border-color: transparent !important;
  box-shadow: 0 0 0 0.15rem rgba(0, 84, 159, 0.15) !important;
  outline: none !important;
}

.msger-input:disabled {
  background-color: #ECEDED;
  opacity: 0.7;
  cursor: not-allowed;
}

.msger-inputarea {
  display: flex;
  border-top: 1px solid #eaecef !important;
  background-color: #f8f9fa !important;
  padding: 12px !important;
  min-height: 60px;
  align-items: center;
  justify-content: center;
}

.input-group {
  display: flex;
  align-items: center;
  width: 100%;
}

.msger-send-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50% !important;
  width: 50px !important;
  height: 50px !important;
  min-width: 50px !important;
  min-height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1) !important;
  transition: all 0.3s ease !important;
  margin-left: 15px !important;
  align-self: center;
}

.msger-send-btn:hover {
  background-color: #003d75;
  transform: translateY(-2px) scale(1.05) !important;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15) !important;
}

.msger-send-btn svg {
  width: 22px !important;
  height: 22px !important;
}

/* ====== MESSAGE STYLES ====== */
.msg {
  display: flex;
  align-items: flex-start;
  margin-bottom: 15px;
  animation: slideIn 0.3s ease forwards;
}

.left-msg {
  flex-direction: row;
}

.right-msg {
  flex-direction: row-reverse;
}

.msg-bubble {
  max-width: 70%;
  padding: 12px 15px;
  border-radius: 18px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  transition: all 0.2s ease;
}

.left-msg .msg-bubble {
  background-color: #e7f2ff !important;
}

.right-msg .msg-bubble {
  background-color: #f8f9fa !important;
  order: 1;
}

.msg-text {
  margin: 0;
  word-break: break-word;
}

.msg-text a {
  color: var(--primary-color);
  text-decoration: none;
}

.msg-text a:hover {
  text-decoration: underline;
}

.msg-info-name {
  display: none;
}

.msg-info-time {
  font-size: 0.8em;
  opacity: 0.7;
}

.right-msg .msg-info-name {
  margin-right: 0;
  margin-left: 10px;
}

.msg-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  color: #495057;
  border-radius: 50%;
  border: 1px solid #e9ecef;
  overflow: hidden;
}

.msg-icon svg {
  width: 24px;
  height: 24px;
}

.right-msg .msg-icon {
  background: #e7f2ff;
  color: #00549F;
}

.bot-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ====== HEADER STYLES ====== */
.header {
  background-color: #e7f2ff;
  border-bottom: 2px solid #e1e8ed;
  color: var(--text-color);
  font-size: larger;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  user-select: none;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  text-align: center;
}

.header-content {
  text-align: center;
  margin: 0 auto;
  align-items: center;
  flex-grow: 1;
}

.header-content h4 {
  color: #00549F;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.header-content p {
  font-size: 0.85rem;
  color: #5a7184;
}

.header .icon img {
  border-radius: 8px;
  padding: 5px;
  background-color: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.header .icon img:hover {
  transform: scale(1.05);
}

.header .btn {
  background-color: #00549F;
  border-color: #00549F;
  color: white;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: 0.2rem;
  transition: all 0.3s ease;
  min-width: 40px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header .btn:hover {
  background-color: #003d75;
  border-color: #003d75;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 84, 159, 0.2);
}

.header .btn svg {
  width: 16px;
  height: 16px;
}

#name {
  font-size: 18px;
  font-weight: bold;
  color: var(--blue);
}

.sub-text {
  font-size: 12px;
  color: var(--blue);
}

.language-btn {
  height: 27px;
  min-width: 27px;
  border: none;
  cursor: pointer;
  align-items: center;
  vertical-align: middle;
  color: var(--blue);
  border-radius: 5px;
  background-color: white;
  justify-content: flex-end;
  padding: 1px 5px;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.language-btn:hover {
  background: var(--assistant-msg-bg);
}

/* Specific elements */
#bigone {
  height: 33px;
  width: 33px;
  margin-left: 10px;
  max-height: 40px;
}

#bigone:hover {
  transform: none !important;
  cursor: default !important;
}

#reload_img, #close_img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Modal styles to add/update in your components.css file */

/* ====== MODAL STYLES ====== */
.modal {
  display: none;
  position: fixed;
  z-index: 1050; /* Increased z-index */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
  outline: 0;
}

.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out;
  transform: translate(0, -50px);
}

.modal.show .modal-dialog {
  transform: none;
}

.modal-dialog {
  position: relative;
  width: auto;
  margin: 0.5rem;
  pointer-events: none;
}

.modal-lg {
  max-width: 800px;
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 0.3rem;
  outline: 0;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #dee2e6;
  border-top-left-radius: calc(0.3rem - 1px);
  border-top-right-radius: calc(0.3rem - 1px);
}

.modal-title {
  margin-bottom: 0;
  line-height: 1.5;
  font-size: 1.25rem;
  font-weight: 500;
}

.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: 1rem;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-end;
  padding: 0.75rem;
  border-top: 1px solid #dee2e6;
  border-bottom-right-radius: calc(0.3rem - 1px);
  border-bottom-left-radius: calc(0.3rem - 1px);
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040; /* Less than modal z-index */
  width: 100vw;
  height: 100vh;
  background-color: #000;
}

.modal-backdrop.fade {
  opacity: 0;
}

.modal-backdrop.show {
  opacity: 0.5;
}

/* Close button */
.btn-close {
  box-sizing: content-box;
  width: 1em;
  height: 1em;
  padding: 0.25em;
  color: #000;
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  border: 0;
  border-radius: 0.25rem;
  opacity: 0.5;
  cursor: pointer;
}

.btn-close:hover {
  opacity: 0.75;
}

/* Terms link styling */
#openTermsBtn {
  cursor: pointer;
  color: #00549F;
  text-decoration: underline;
}

@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
  }
  
  .modal-dialog-scrollable {
    height: calc(100% - 3.5rem);
  }
  
  .modal-lg {
    max-width: 800px;
  }
}

/* ====== DISCLAIMER STYLES ====== */
.disclaimer-container {
  text-align: center;
  width: 100%;
  padding: 15px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  border-top: 1px solid rgb(0, 0, 0); 
  font-size: 0.8rem;
  color: #777;
}

#disclaimer {
  padding-bottom: 2px;
  font-size: 12px;
  text-align: center;
}

.disclaimer-text {
  font-size: 12px;
}

.terms-link {
  color: rgb(0, 84, 159);
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

#openTermsBtn {
  cursor: pointer;
}

/* ====== CODE BLOCK STYLES ====== */
.msg-text pre {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 10px;
  overflow-x: auto;
  margin: 10px 0;
  white-space: pre-wrap;
}

.msg-text code {
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  background: #000000;
  color: #FFFDEE;
  font-size: 15px;
  font-family: Arial, Helvetica, sans-serif;
}

.code-block {
  background-color: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg-text .codehilite {
  background: transparent;
  padding: 0;
  margin: 0;
}

.msg-text .codehilite pre {
  margin-top: 5px;
  border: none;
  border-radius: 5px;
  padding: 1em 1.5em;
  overflow-x: auto;
}

code {
  margin-top: 5px;
  border: None;
  border-radius: 5px;
  page-break-inside: avoid;
  line-height: 1.6;
  margin-bottom: 1.6em;
  padding: 1em 1.5em;
  display: block;
  word-wrap: break-word;
  overflow-x: scroll;
}

/* Code Highlighting */
.codehilite .k, .codehilite .kd, .codehilite .kn, .codehilite .kr, .codehilite .kt { color: #407FB7; }
.codehilite .s, .codehilite .s1, .codehilite .s2, .codehilite .sb { color: #CD8B87; }
.codehilite .mi, .codehilite .mf, .codehilite .nx { color: #B8D698; }
.codehilite .c, .codehilite .c1, .codehilite .cm { color: #57AB27; }
.codehilite .nf, .codehilite .fm { color: #E0E69A; }
.codehilite .nb, .codehilite .bp { color: #7DA4A7; }
.codehilite .n, .codehilite .nx { color: #8EBAE5; }
.codehilite .o, .codehilite .ow { color: #CFD1D2; }
.codehilite .p { color: #CFD1D2; }
.codehilite .sr { color: #E96088; }
.codehilite .sb, .codehilite .si { color: #CD8B87; }
.codehilite .nc { color: #7DA4A7; }
.codehilite .nd { color: #407FB7; }
.codehilite .nt { color: #407FB7; }
.codehilite .na { color: #8EBAE5; }
.codehilite .dt { color: #407FB7; }
.codehilite .nc, .codehilite .nt, .codehilite .nf { color: #E69679; }
.codehilite .nl, .codehilite .nb { color: #8EBAE5; }
.codehilite .m, .codehilite .mf, .codehilite .mi, .codehilite .mo { color: #B8D698; }
.codehilite .kt { color: #B8D698; }
.codehilite .nd, .codehilite .nc { color: #E69679; }
.codehilite .k, .codehilite .kd { color: #407FB7; }
.codehilite .tag { color: #407FB7; }

/* ====== LOADING ANIMATION ====== */
.loading-dots {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

.loading-dots span {
  background-color: #00549F !important;
  border-radius: 50%;
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 3px;
  animation: dots 1.5s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

/* ====== ANIMATIONS ====== */
@keyframes dots {
  0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes loading {
  0%, 80%, 100% {
    transform: scale(0);
  } 40% {
    transform: scale(1.0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ====== SPECIAL EFFECTS ====== */
.background-text {
  background: linear-gradient(45deg, var(--rwth-red), var(--rwth-red), #00549F, #00549F);
  animation: gradient 3s ease infinite;
  background-size: 400% 400%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Additional modal fixes to ensure proper behavior with Bootstrap */

/* Ensure body styles are properly reset when backdrop is removed */
body.modal-open {
  overflow: hidden;
  padding-right: 0 !important;
}

/* When modal is closed, ensure these styles are removed */
body:not(.modal-open) .modal-backdrop {
  display: none !important;
}

/* Ensure modal backdrop is properly styled and can be clicked through when not active */
.modal-backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  transition: opacity 0.15s linear;
}

.modal-backdrop.show {
  opacity: 0.5;
}

.modal-backdrop.fade:not(.show) {
  opacity: 0;
  pointer-events: none;
}

/* Ensure modal dialog transitions smoothly */
.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out;
  transform: translate(0, -50px);
}

.modal.show .modal-dialog {
  transform: none;
}

/* Handle cases where modal is closed but still visible */
.modal:not(.show) {
  display: none !important;
}

/* Fix for cases where modal gets stuck */
.modal.fade.fixing {
  display: none !important;
}

p {
  margin-bottom: 0;
}

.messenger-area {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  position: relative;
}

.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #e7f2ff;
  flex-shrink: 0;
}

.msger-chat {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
}

.msger-inputarea {
  position: sticky;
  bottom: 0;
  z-index: 1000;
  background-color: white;
  flex-shrink: 0;
}

.disclaimer-container {
  position: sticky;
  bottom: 0;
  z-index: 999;
  background-color: #f8f9fa;
  flex-shrink: 0;
}

/* Ensure content container takes full height */
#content {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

/* For mobile devices */
@media (max-width: 768px) {
  .messenger-area {
    height: 100dvh;
    max-height: 100dvh;
    width: 100%;
  }

  .header {
    padding: 0.75rem !important;
  }

  .msger-inputarea {
    padding: 0.75rem !important;
  }
}