/* Main Component Styles */

/* Layout Components */
.chat-container {
  width: 100%;
  height: 100%;
  margin: 1.25rem;
  max-width: 40rem;
  max-height: 60rem;
  background: var(--color-bg-white);
  border-radius: 1.25rem;
  box-shadow: 0 1.25rem 2.5rem var(--color-shadow-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: var(--color-primary);
  color: var(--color-text-white);
  padding: 1.25rem;
  text-align: center;
}

.chat-messages {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  background: var(--color-bg-chat);
  background-image: url("images/chat-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.choices-container {
  padding: 0rem 1.25rem;
  background: var(--color-bg-chat);
  display: none; /* Hide since we're using inline interactive buttons */
  min-height: 0;
}

/* Message Components */
.message {
  margin-bottom: 0.9375rem;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
}

.message.bot { 
  justify-content: flex-start;
  align-items: flex-start;
}

.message.user { 
  justify-content: flex-end;
  align-items: flex-end;
}

.message-bubble {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 1.125rem;
  word-wrap: break-word;
}

.message.bot .message-bubble {
  background: var(--color-bg-white);
  border-bottom-left-radius: 0.25rem;
  box-shadow: 0 0.0625rem 0.125rem var(--color-shadow-light);
}

.message.user .message-bubble {
  background: var(--color-bg-user-message);
  border-bottom-right-radius: 0.25rem;
  box-shadow: 0 0.0625rem 0.125rem var(--color-shadow-light);
}

/* Button Components */
.btn {
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-white);
  padding: 0.75rem 1.5rem;
  border-radius: 1.5625rem;
  font-size: 1rem;
  box-shadow: 0 0.125rem 0.5rem var(--color-shadow-primary);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-0.0625rem);
  box-shadow: 0 0.25rem 0.75rem var(--color-shadow-primary-hover);
}

.choice-button {
  display: block;
  width: 100%;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  background: var(--color-bg-light);
  border: 0.0625rem solid var(--color-border-light);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9375rem;
  text-align: left;
  color: var(--color-text-dark);
}

.choice-button:hover {
  background: var(--color-bg-gray);
  border-color: var(--color-primary);
  transform: translateY(-0.0625rem);
}

.choice-button:last-child { 
  margin-bottom: 0; 
}

/* Bottom Sheet */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-shadow-dark);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.bottom-sheet-overlay.active {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 70vw;
  max-width: 50rem;
  background: var(--color-bg-white);
  border-radius: 1.25rem 1.25rem 0 0;
  padding: 1.25rem;
  max-height: 70vh;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1001;
}

.bottom-sheet.active { 
  transform: translateX(-50%) translateY(0); 
}

.bottom-sheet-handle {
  width: 2.5rem;
  height: 0.25rem;
  background: var(--color-border-gray);
  border-radius: 0.125rem;
  margin: 0 auto 0.9375rem;
}

.bottom-sheet-close {
  position: absolute;
  right: 0;
  top: 0;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
  width: 1.875rem;
  height: 1.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  padding: 0.625rem 1rem;
  background: var(--color-bg-white);
  border-radius: 1.125rem;
  border-bottom-left-radius: 0.25rem;
  margin-bottom: 0.9375rem;
  max-width: 80%;
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
}

.typing-dots span {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--color-text-gray);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

.typing-dots span:nth-child(3) { 
  animation-delay: 0.4s; 
}

@keyframes typing {
  0%, 60%, 100% { 
    transform: translateY(0); 
    opacity: 0.5; 
  }
  30% { 
    transform: translateY(-0.625rem); 
    opacity: 1; 
  }
}

/* Logo */
.logo {
  width: 1.875rem;
  height: 1.875rem;
  background: var(--color-primary-light);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.625rem;
  font-weight: bold;
  font-size: 0.875rem;
}

/* Responsive bottom sheet widths */
@media (max-width: 1280px) {
  .bottom-sheet {
    width: 95vw;
  }
}

@media (max-width: 30rem) {
  .bottom-sheet {
    width: 100%;
    left: 0;
    transform: translateY(100%);
    border-radius: 1.25rem 1.25rem 0 0;
  }
  
  .bottom-sheet.active {
    transform: translateY(0);
  }
}

/* WhatsApp-style Input Field */
.input-container {
  display: flex;
  align-items: center;
  background: var(--color-bg-white);
  border-radius: 1.5rem;
  padding: 0.5rem;
  /* box-shadow: 0 0.125rem 0.5rem var(--color-shadow-light); */
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1; /* Take available space but allow natural sizing */
  max-width: 100%;
  min-width: 200px; /* Minimum width for usability */
}

.input-container:hover {
  box-shadow: 0 0.25rem 0.75rem var(--color-shadow-light);
}

.input-field {
  flex: 1;
  min-width: 0; /* Allow shrinking below content width */
  max-width: none; /* Remove any max-width constraints */
  border: none;
  outline: none;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: transparent;
  color: var(--color-text-dark);
  pointer-events: none; /* Disable actual typing */
}

.input-field::placeholder {
  color: var(--color-text-muted);
}

.send-button {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: var(--color-text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.125rem;
  margin-left: 0.5rem;
}

.send-button:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
}

.attachment-button {
  width: 2rem;
  height: 2rem;
  min-width: 2rem; /* Prevent shrinking below this width */
  flex-shrink: 0; /* Prevent flex container from shrinking this element */
  border-radius: 50%;
  border: none;
  background: var(--color-bg-gray);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  margin-right: 0.5rem;
}

.attachment-button:hover {
  background: var(--color-border-gray);
  color: var(--color-text-dark);
}

/* WhatsApp Interactive Buttons */
.interactive-buttons-container {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  /* max-width: 300px; */
  width: auto;
  align-self: flex-start;
  gap: 0.5rem;
}

.interactive-button {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0.75rem 1rem;
  background: #efe3ff; /* Light purple background */
  border: 0;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  min-height: auto;
  white-space: normal;
  overflow: visible;
  margin-bottom: 0;
  /* width: 100%; */
  box-sizing: border-box;
  box-shadow: 0 0.0625rem 0.125rem var(--color-shadow-light);
  word-wrap: break-word;
  hyphens: auto;
}

.interactive-button-disabled {
  /* background: var(--color-bg-gray); */
  opacity: 0.5;
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.interactive-button:hover {
  background: #d4bbff; /* Slightly darker purple on hover */
  /* border-color: #25d366; */
}

.interactive-button:active {
  transform: translateY(0);
  background: #c4a1ff; /* Darker purple on active */
}

.interactive-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  background: #f0f0f0;
  color: #999;
  /* border-color: #ddd; */
}

/* Icon for interactive buttons */
.interactive-button .icon {
  margin-right: 0.5rem;
  font-size: 1rem;
  flex-shrink: 0;
  align-self: flex-start;
  line-height: 1;
}

/* Responsive behavior for mobile - keep inline layout but allow text wrapping */
@media (max-width: 768px) {
  .interactive-button {
    /* padding: 0.625rem 0.75rem; */
    /* font-size: 0.8125rem; */
    /* line-height: 1.4; */
    /* max-width: 280px; */
  }
  
  .interactive-button .icon {
    /* font-size: 0.9375rem; */
    /* margin-right: 0.375rem; */
  }
}

/* Even more compact for very small screens */
@media (max-width: 480px) {
  .interactive-button {
    /* padding: 0.5rem 0.625rem; */
    /* font-size: 0.75rem; */
    /* line-height: 1.3; */
    /* max-width: 240px; */
  }
  
  .interactive-button .icon {
    /* font-size: 0.875rem; */
    /* margin-right: 0.25rem; */
  }
}

.button-group {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.reset-button, .undo-button {
  background: var(--color-bg-light);
  border: 1px solid var(--color-border-light);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
}

.reset-button:hover {
  background: var(--color-bg-gray);
  transform: rotate(180deg);
}

.undo-button:hover {
  background: var(--color-bg-gray);
}

.undo-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
}