/* === Chat Bar Toggle === */

.chat-nav {
  position: fixed;
  width: 100%;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.3s ease;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  pointer-events: none;
  z-index: 1040;
  overflow: hidden;
}

.chat-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(32, 47, 74, 0.8) 0%, rgba(32, 47, 74, 0.4) 50%, rgba(32, 47, 74, 0) 100%);
  pointer-events: none;
}

.chat-nav.shown {
  transform: translateY(0%);
  opacity: 1;
  pointer-events: auto;
}

/* Dark Transparent Blurry Navbar */

.keyboard-nav {
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  background-color: rgba(32,47,74,0);
}

/* === Handle Button === */

.chat-handle {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 16px 16px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  cursor: pointer;
  z-index: 10510;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.chat-handle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateX(-50%) scale(1.05);
}

/* === Chat Input & Messages === */

.chat-input {
  font-size: 16px;
  border: none;
  background-color: transparent;
  color: white;
  border-radius: 999px;
  box-shadow: none !important;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* === Scrollable Chat Wrapper === */

.chat-scroll-wrapper {
  position: relative;
  max-height: 85vh;
  overflow-y: scroll;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  border-radius: 16px;
  scrollbar-width: thin;
  /*Firefox: thin scrollbar always;*/
}

/* Webkit Scrollbar Track always reserved */

.chat-scroll-wrapper::-webkit-scrollbar {
  width: 8px;
}

/* Hide thumb completely by default */

.chat-scroll-wrapper::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

/* On hover/focus: fade thumb in */

.chat-scroll-wrapper:hover::-webkit-scrollbar-thumb, .chat-scroll-wrapper:focus-within::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.4);
}

/* Firefox: hide thumb by default (no true opacity control, but set color transparent) */

.chat-scroll-wrapper {
  scrollbar-color: transparent transparent;
}

.chat-scroll-wrapper:hover, .chat-scroll-wrapper:focus-within {
  scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
}

/* === AI Typing Bubble & Tail === */

.typing-bubble {
  background-color: #1d2b3a;
  color: #ffffff;
  font-size: 0.95rem;
  position: relative;
  border-radius: 12px;
}

/* === USER (Right Bubble, Tail on Bottom-Right) === */

.user-tail {
  transform: rotate(60deg);
  fill: #0a84ff;
}

/* === AI (Left Bubble, Tail on Bottom-Left) === */

.ai-tail {
  transform: rotate(-60deg);
  fill: #293c5c;
}

/* === Optional Smooth SVG === */

/* === Scroll to Bottom Button === */

.scroll-down-btn {
  position: fixed;
  bottom: 20px;
  left: 1rem;
  z-index: 99;
  display: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.25rem;
  box-shadow: 0 0 10px rgba(0,0,0,0.15);
}

/* === Fades for Top & Bottom === */

.chat-scroll-fade-top, .chat-scroll-fade-bottom {
  position: absolute;
  left: 0;
  width: 100%;
  height: 120px;
  pointer-events: none;
  z-index: 1;
}

.chat-scroll-fade-top {
  top: 0;
  background: linear-gradient(to bottom, rgba(32,47,74,0.78), transparent);
}

.chat-scroll-fade-bottom {
  bottom: 0;
  background: linear-gradient(to top, rgba(32,47,74,1), transparent);
}

/* === Chat Container & Inner === */

.chat-container-wrapper {
  width: 100%;
  /*max-height: 100vh;*/
  margin: auto;
}

.chat-scroll-inner {
  padding: 1rem;
  padding-top: 5rem;
  padding-bottom: 25vh;
  max-width: 100%;
}

/* === Mobile Adjustments === */

@media (max-width: 600px) {
  .chat-handle {
    left: 80%;
    transform: translateX(-80%);
  }
}

/* IOS CHAT */

.chat-message p {
  margin: 0 0 2px 0;
  font-weight: 600;
  font-size: 0.8rem;
  color: #b0b3b8;
  text-align: left;
}

.chat-message {
  display: flex;
  align-items: flex-end;
  margin-bottom: 1.2rem;
  animation: fadeInUp 0.3s ease;
  max-width: 90%;
}

.chat-message.user {
  flex-direction: row-reverse;
  /*justify-content: flex-end;*/
  align-self: flex-end;
  margin-left: auto;
  width: 100%;
}

.chat-message.ai {
  flex-direction: row;
  justify-content: flex-start;
}

.chat-message .bubble {
  padding: 12px 16px;
  font-size: 0.95rem;
  border-radius: 20px;
  word-wrap: break-word;
  position: relative;
  max-width: 100%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* === iOS Blue for User === */

.chat-message.user .bubble {
  background-color: #0a84ff;
  color: #ffffff;
  border-radius: 20px 20px 10px 20px;
  align-self: flex-end;
  margin-left: auto;
  position: relative;
}

.chat-message.user .bubble::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 6px;
  width: 12px;
  height: 12px;
  background-color: #0a84ff;
  border-bottom-right-radius: 50%;
}

/* === iOS Gray for AI === */

/* White */

.chat-message.ai .bubble {
  background-color: #293c5c;
  color: #f1f1f3;
  border-radius: 20px 20px 20px 20px;
}

.chat-message.ai .bubble::after {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 6px;
  width: 12px;
  height: 12px;
  background-color: #293c5c;
  border-bottom-left-radius: 50%;
}

/* Dark */

/* .chat-message.ai .bubble {
  background-color: #f1f1f1;
  color: #222;
  border-radius: 20px 20px 20px 20px;
}

.chat-message.ai .bubble::after {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 6px;
  width: 12px;
  height: 12px;
  background-color: #f1f1f1;
  border-bottom-left-radius: 50%;
} */

/* === Profile Icon === */

.chat-message .icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-top: 2px;
}

.chat-message.user .icon {
  margin-left: 0.75rem;
}

.chat-message.ai .icon {
  margin-right: 0.75rem;
}

/* === Sender Name === */

.chat-message p {
  margin: 0 0 4px 0;
  font-weight: 600;
  font-size: 0.8rem;
  color: #b0b3b8;
}

/* === Message Pop Animation === */

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Responsive Scaling === */

@media (max-width: 600px) {
  .chat-message .bubble {
    max-width: 90%;
    font-size: 0.92rem;
  }
}

@media (max-width: 600px) {
  .chat-message .icon {
    width: 28px;
    height: 28px;
  }
}

/* IOS CHAT end */

/* .chat-message {
  margin-bottom: 1.5rem;
}

.chat-message .bubble {
  background-color: #293c5c;
  border-radius: 32px;
  padding: 15px;
}

.chat-message.user {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-start;
}

.chat-message.user .bubble {
  background-color: #1d2b3a;
  text-align: right;
} */

.chat-scroll-wrapper {
  overscroll-behavior-y: contain;
}

.chat-scroll-wrapper {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav button {
  flex: 1 1 0;
  margin: 0 5px;
}

@media (min-width: 786px) {
  .quiz-nav {
    top: 59px;
  }
}

@media (max-width: 768px) {
  .mobile-nav {
    position: fixed !important;
    top: 0 !important;
    border-radius: 0;
  }
}

@media (max-width: 768px) {
  .sticky-top {
    top: 0 !important;
  }
}

@media (min-width: 768px) {
  .back-ground {
    background-image: url("../../assets/img/background.png")!important;
  }
}

@media (min-width: 768px) {
  .back-ground {
    background-image: url("../../assets/img/background.png")!important;
  }
}

@media (max-width: 992px) {
  .header-chat {
    padding-top: 0px!important;
  }
}

@media (max-width: 900px) {
  .chat {
    position: fixed;
    width: 100%;
    left: 0px;
  }
}

