.ai-chatbox {
    width: 100%;
    background: #fff;
    margin: 40px auto;
    overflow: hidden;
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 1;
    border-radius: 32px;
    padding: 40px 20px;
}

.ai-form {
    width: 100%;
    max-width: 768px;
    margin: auto;
    display: flex;
    justify-content: center;
}

.ai-chatbox.initial-state {
    width: 100%;
    margin: 40px auto;
    border-radius: 32px;
    opacity: 1;
    position: relative;
    z-index: 0;
    overflow: hidden;
    height: 796px;
}

.ai-chatbox.initial-state .ai-chatbox-content {
    display: flex;
    gap: 36px;
    align-items: center;
    flex-direction: column;
    height: 796px;
    text-align: center;
    justify-content: center;
}

.ai-chatbox.initial-state .ai-form {
    margin: 0;
}

.ai-chatbox.initial-state .ai-reset {
    display: none;
}

.ai-chatbox.initial-state #chat-messages {
    display: none;
}

.ai-chatbox.initial-state h2 {
    font-size: 36px;
    font-family: 'Raleway', sans-serif;
    font-weight: bold;
    margin-bottom: 20px;
    color: #000;
}

#chat-messages {
    padding: 20px;
    height: 640px;
    max-width: 768px;
    margin: auto;
    width: 100%;
    overflow-y: auto;
}

.chat-message {
    padding: 10px 20px;
    margin-bottom: 16px;
    border-radius: 24px;
    max-width: 90%;
    line-height: 1.4;
    display: inline-block;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

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

.chat-message.user {
    background: #EEF3F5;
    text-align: left;
    align-self: flex-end;
    float: right;
    clear: both;
}

.chat-message.assistant {
    text-align: left;
    align-self: flex-start;
    float: left;
    clear: both;
}

.chat-message.assistant a {
    color: #007aa4; /* Link color */
    text-decoration: underline;
}

.chat-message ol {
    margin: 10px 0;
    padding-left: 20px;
}

.chat-message ol li {
    list-style-type: decimal;
    margin-bottom: 5px;
    color: #333;
}

.input-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    max-width: 700px;
    width: 100%;
    height: 58px;
    padding: 12px 12px 12px 32px;
    border: 1px solid #CED1D3;
    border-radius: 2.5rem;
    margin: 0 auto;
}

.ai-chatbox.initial-state .input-wrapper {
    max-width: 700px;
    width: calc(100% - 20px);
    position: absolute;
    bottom: 100px;
}

.input-wrapper input {
    flex: 1;
    font-size: 14px;
    line-height: 24px;
    outline: none;
    background: #fff;
}

.input-wrapper button {
    background: #007AA4;
    color: white;
    border: none;
    border-radius: 100%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    cursor: pointer;
}

.input-wrapper button:hover {
    background: #333;
}

#ai-chat-loading {
    text-align: center;
    padding: 10px;
    font-style: italic;
    color: #888;
    clear: both;
}

button.ai-reset {
    font-size: 24px;
}


@keyframes dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
    100% { content: '.'; }
}

#ai-chat-loading::after {
    content: '.';
    animation: dots 1.5s infinite steps(1, end);
}

/* Style for AI chat table */
.ai-html table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 14px;
}

.ai-html table th,
.ai-html table td {
    border: 1px solid rgb(0, 122, 164)!important;
    padding: 8px!important;
    text-align: left;
}

.ai-html table th {
    background-color: rgb(0, 122, 164);
    color: white;
    font-weight: bold;
}

.ai-html table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.ai-html table tr:hover {
    background-color: #f1f1f1;
}
.dark .ai-html table {
    background-color: #222;
    color: #fff;
}

.dark .ai-html table th {
    background-color: #007aa4;
    color: #fff;
}

.dark .ai-html table td {
    background-color: #222;
    color: #fff;
}

.dark .ai-html table tr:nth-child(even) {
    background-color: #2c2c2c;
}

.dark .ai-html table tr:hover {
    background-color: #333;
}

.dark .ai-html table,
.dark .ai-html table th,
.dark .ai-html table td {
    border-color: #007aa4 !important;
}

.dark .ai-html tr:nth-child(even) {
    background-color: #505050;
}

.ai-chatbox h3 {
    font-size: 18px;
    font-weight: bold;
}

.chat-message ul {
    margin: 0;
    padding-left: 20px;
}

.chat-message ul li {
    list-style-type: disc;
    margin-bottom: 5px;
    color: #333;
}

.typing-cursor {
  display: inline-block;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
  to {
    visibility: hidden;
  }
}
.input-wrapper button.ai-reset {
  background: none;
  border: none;
  color: #888;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-size: 28px;
  margin-left: 30px;
}

.ai-reset button:hover {
  color: #7e0000;
}

.ai-html p {
    margin-bottom: 1.5rem!important;
}

.ai-html li p {
    margin-bottom: 10px!important;
}

.ai-html ul, .ai-html ol {
    margin-bottom: 1rem;
}

.typing-cursor {
  display: inline-block;
  font-weight: bold;
  font-size: 20px;
  color: #007aa4;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
  to {
    visibility: hidden;
  }
}
.ai-reset:hover {
  color: #7e0000;
}

@media screen and (max-width: 768px) {
    .chat-message.assistant {
        padding: 10px 0px;
        max-width: 100%;
    }
    .ai-reset {
        display: none;
    }
}

.dark .chat-message.user {
    background: #000;
    color: #fff;
}

.dark .ai-chatbox {
    background-color: #2c2c2c;
    color: #fff;
}

.dark .ai-chatbox p, .dark .ai-chatbox li, .dark .ai-chatbox h2, .dark .ai-chatbox h3 {
    color: #fff;
}

.dark .input-wrapper button {
    background: #777;
    color: #fff;
}

.dark .input-wrapper {
    background: transparent;
}

.dark .input-wrapper input {
    background: transparent;
    color: #fff;
    border: none;
}

.dark .ai-chatbox.initial-state .input-wrapper input {
    color: #333;
}

.dark .ai-chatbox.initial-state .input-wrapper {
    width: calc(100% - 20px);
    border-color: #333;
}

.dark .input-wrapper button.ai-reset {
    background: transparent!important;
}

.dark .ai-chatbox.initial-state input:autofill {
    background-color: transparent!important;
    color: #fff !important;
}

.ai-chatbox.initial-state::before {
  content: "";
  position: absolute;
  border-radius: 100%;
  inset: -50%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.1) 70%);
  animation: moveLight 6s linear infinite;
  z-index: -1;
  pointer-events: none;
  transform: scale(1.5);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ai-chatbox.initial-state:hover::before {
  opacity: 1;
}

@keyframes moveLight {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1.5);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg) scale(1.5);
  }
}

.dark #page p {
    color: #fff!important;
}