
/*Fully Responsive & Modern Dark Theme*/
   
*{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  margin: 0;
  background-color: #212121; /* Same as chat bg so it looks seamless */
  display: flex;
  justify-content: center;
    height: 100vh;

/* Ensure the chat container takes up the full mobile screen */
.chat {
  width: 100%;
  max-width: 800px;
  height: 100vh;
  height: -webkit-fill-available; /* Fix for mobile browser address bars */
  display: flex;
  flex-direction: column;
  position: relative;
  margin: 0 auto;
  background: #212121;
}

/* ====================== HEADER ====================== */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background-color: #212121;
  z-index: 100;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-dot {
  width: 9px;
  height: 9px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 10px #22c55e;
  animation: pulse 2s infinite ease-in-out;
}

.chat-header h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.clear-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #b4b4b4;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ====================== MESSAGES AREA ====================== */
#messages {
  flex: 1;
  padding: 20px 16px 120px 16px; /* Increased bottom padding */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling for mobile Safari/Chrome */
  display: flex;
  flex-direction: column;
  gap: 20px;
}
/* Custom Scrollbar */
#messages::-webkit-scrollbar {
  width: 6px;
}

#messages::-webkit-scrollbar-thumb {
  background: #424242;
  border-radius: 10px;
}

#messages::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.row {
  display: flex;
  width: 100%;
  animation: messageFadeIn 0.35s ease forwards;
}

.user-row {
  justify-content: flex-end;
}

.ai-row {
  align-items: flex-start;
  gap: 12px;
}

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

.msg {
  box-shadowbox-shadow: 0 2px 6px rgba(0,0,0,0.2);
  padding: 13px 19px;
  border-radius: 20px;
  font-size: 15.2px;
  line-height: 1.55;
  max-width: 78%;
  word-wrap: break-word;
  hyphens: auto;
}

.user {
  background-color: #2563eb;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-bottom-right-radius: 5px;
}

.ai {
  background: #2a2a2a;
  color: #e0e0e0;
  border-radius: 20px;
  border-bottom-left-radius: 5px;
}

.avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.35);
}

/* ====================== INPUT AREA ====================== */
.input-container {
  position: fixed; 
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 800px; 
  padding: 20px 24px 28px;
  background: linear-gradient(transparent, #212121 30%, #212121 100%);
  z-index: 200;
}


.input-area {
  position: relative;
  width: 100%;
  display: flex;
  align-items: flex-end; /* Keeps arrow at the bottom-right */
  background: #2f2f2f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

textarea {
  flex: 1;
  padding: 14px 50px 14px 16px; /* 50px right padding protects the arrow area */
  background: transparent;
  border: none;
  color: white;
  font-size: 16px;
  outline: none;
  resize: none;
  min-height: 52px;
  max-height: 200px;
  line-height: 1.5;
  font-family: inherit;
  overflow-y: hidden;
}
textarea:focus {
  border: 1px solid rgba(255, 255, 255, 0.3);
}


.send-btn {
  position: absolute;
  right: 10px;
  bottom: 10px; /* Locked to the bottom regardless of height */
  background: white;
  color: black;
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
}
/* ====================== TYPING INDICATOR ====================== */
.typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 20px;
  width: fit-content;
}

.dot {
  width: 6px;
  height: 6px;
  background: #888;
  border-radius: 50%;
  animation: typingBounce 1.35s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* ====================== FOOTER ====================== */
.footer-text {
  text-align: center;
  font-size: 11px;
  color: #555;
  margin-top: 12px;
  user-select: none;
  pointer-events: none;
}

/* ====================== RESPONSIVE DESIGN ====================== */
@media (max-width: 640px) {
  .chat-header {
    padding: 14px 18px;
  }

  #messages {
    padding: 18px 16px 130px 16px;
    gap: 16px;
  }

  .input-container {
    padding: 16px 16px 24px;
  }

  .msg {
    max-width: 88%;
    font-size: 15px;
  }

  #user-input {
    font-size: 15.5px;
    padding: 14px 54px 14px 18px;
  }
}

/* Optional: Hide scrollbar on mobile for cleaner look */
@media (max-width: 768px) {
  #messages::-webkit-scrollbar {
    width: 3px;
  }
}
