html {
  height: 100%;
}

body{
    background: #E7F7A4;
    font-family: 'Lato', sans-serif;
    font-size: 1.25rem;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 1em;
}

h1 {
  font-size: 1.25em;
  text-align: center;
  color: #463b0b;
  margin-top: 0;
}

.contact-link {
  color: #fe4c55;
}

.chat-interface {
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 38em;
  margin-bottom: 2em;
  flex-grow: 3;


}

.messages-container {
    border-radius: 32px;
    overflow: hidden;
    margin-bottom: 1em;
    min-height: 0;
    background: white;
    display: flex;
    flex-direction: column;
    padding: 0 2em;
    padding-right: 0;
    flex-grow: 3;
}


   
.messages-container:before {
    content:'';
    width:100%;
    height: 3em;    
    position:absolute;
    left:0;
    top:0;
    background:linear-gradient(white, transparent);
    border-radius: 32px 32px 0 0;
  } 
  

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding-right: 2em;
  padding-top: 2em;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */

}


.message-wrapper {
  margin-bottom: 1.5em;
  scroll-margin-top: 1.5em;
  overflow: visible;

}

.bot-message {
  display: flex;
  gap: 1em;
  align-items: flex-start;
}

.avatar {
  width: 1.5em;
  height: 1.5em;
  border-radius: .65em .15em;
  background: #fe4c55;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1em;
  font-weight: 700;
}

.message-content {
  flex: 1;
}

.message-text {
  font-size: 1em;
  line-height: 1.5;
  color: #463b0b;
  /* user-select: none; */

}
.message-text.typing-complete {
    user-select: text;
}

.options-container {
  margin-left: 2.5em;
  margin-top: 1.5em;
  flex-direction: column;
    /* border-radius: 24px; */
    /* border: solid 1px #0000001f; */
overflow: hidden;
display: none;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
    gap: .5em;

   
}

.option-button.pre-animation {
  opacity: 0;
  transform: translateY(1.5em);
}

.option-button.animate-in {
  animation: slideIn .3s ease-in-out forwards;
}

@keyframes fadeIn {
    to {
        display: flex;
        opacity: 1;
    }
}

.option-button {
  width: 100%;
  text-align: left;
  padding: .5em 1em;
  background: white;
    border:none;
  cursor: pointer;
  transition: all 200ms;
  display: flex;
  align-items: center;
  gap: 1em;
  font-size: 1em;
  line-height: 1.5em;
  border: dotted 3px #E2E100;
  border-radius: 24px;
  transition: background-color 0.1s ease-in-out, border 0.1s ease-in-out;
  color: rgb(70 59 11 / 85%);

}

.option-button:not(.selected):hover {
    background: #E7F7A4;
    border: solid 3px #E7F7A4;
    color: rgb(0 0 0 / 85%);


}

.option-button.selected {
  background: none;
  cursor: default;
  color: rgba(0, 0, 0, 0.5);
  border: solid 3px #e6f7a400;
}

.option-button.disabled {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
    color: rgba(0, 0, 0, 0.5);
    /* background: #f5f5f5; */
    border: solid 3px #e6f7a400;

}

/* Loading state for send button */
.send-button:disabled {
opacity: 0.7;
cursor: not-allowed;
}

.user-message {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5em;
}

.user-content {
  background: #E5E59B;
  border-radius: 24px;
  padding: .5em 1em;
  max-width: 80%;
  font-size: 1em;
}

.input-container {
  /* flex-grow: 0; */

}

.input-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 0 1em 0 0;
  margin: 0;
  border-radius: 32px;
  overflow: hidden;
  background: white;
}

.chat-input {
  width: 100%;
  padding: 1.5em;
  border: none;
  font-size: 1em;
  outline: none;
  background: white;
  color: rgb(70 59 11);

}

input.chat-input:focus {
    border-bottom: none;
}

input.chat-input:hover {
    background: #00000009;
}

.send-button {
  padding: 1em;
  border-radius: 9999px;
  background: #E5E59B;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 200ms;
  color: #463b0b;

}

.send-button:hover {
  background: #E2E100;
}

.arrow-icon {
  width: 2em;
  height: 2em;
}



  /* New loading indicator styles that match your theme */
  .typing-indicator {
    display: none;
    padding: 1.5em 0;
    margin-left: 4em; /* Aligns with your message content */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.typing-indicator.visible {
    display: flex;
    opacity: 1;
}

.typing-indicator span {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    background-color: #fe4c55; /* Matches your avatar color */
    border-radius: 50%;
    opacity: 0.4;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(1) { 
    animation-delay: 0s; 
}

.typing-indicator span:nth-child(2) { 
    animation-delay: 0.2s;
    background-color: #fe4c55b0; /* Slightly lighter shade */
}

.typing-indicator span:nth-child(3) { 
    animation-delay: 0.4s;
    background-color: #fe4c5546; /* Even lighter shade */
}

@keyframes typing {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-8px);
        opacity: 0.8;
    }
}

/* State styles for disabled inputs */
.chat-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}



.messages-container {
    position: relative;
    overscroll-behavior: contain; /* Prevents scroll chaining */
}

.chat-messages {
    position: relative;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.typing-indicator {
    margin: 1em 0 1em 4em;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.typing-indicator.visible {
    opacity: 1;
}

/* Add message states */
.message-wrapper {
    opacity: 0;
    transform: translateY(10px);
    animation: messageAppear 0.3s ease forwards;
}

@keyframes messageAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Add focus states for accessibility */
.chat-input:focus {
    /* outline: 2px solid #E2E100; */
    /* outline-offset: -2px; */
}



/* Add loading states */
.send-button.loading {
    background: #f0f0f0;
    pointer-events: none;
}

.send-button.loading .arrow-icon {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    50% {
        opacity: 0.5;
    }
}

@media only screen and (max-width: 600px) {
  .messages-container {
    padding-left:1em;
  }
  .chat-messages {
    padding-right: 1em;
    padding-top: 1em;
  }
  .bot-message {
    gap: .75em;
  }
  .options-container {
    margin-left: 2em;
    margin-top: 1em;
  }
  .option-button {
    padding: .25em .5em;
    gap: .5em;
  }

  .chat-input {
    padding: 1.25em 0 1.25em 1em;
  }
  .input-form {
    gap: .5em;
    padding: 0 .5em 0 0;
  }
}

