/* -------------------- Global Reset -------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* -------------------- Body -------------------- */
body {
  background-color: white;
  display: block;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

/* -------------------- Chat Page Wrapper -------------------- */
#chatPage {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh; /* fixed height */
  overflow: hidden;
}

/* -------------------- Chat Container -------------------- */
#chatPage #chatContainer {
  width: 800px;
  height: calc(100vh - 60px); /* fixed bottom spacing */
  max-height: 100vh;
  border-radius: 10px;
  padding-right: 0px;
  padding-left: 0px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-left: 500px;
  background: white;
  margin-top: 60px;
}

/* -------------------- Messages Section -------------------- */
#chatPage #messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

#chatPage .message {
  padding: 10px 15px;
  border-radius: 15px;
  word-wrap: break-word;
  line-height: 1.6;
}

#chatPage .message.user {
  background: rgb(255, 151, 5);
  color: white;
  align-self: flex-end;
  max-width: 80%;
  border-bottom-right-radius: 0;
  padding: 8px 12px;
  font-size: 16px;
}

#chatPage .message.ai {
  color: #333;
  align-self: stretch;
  width: 100%;
  border-bottom-left-radius: 0;
  padding: 12px 22px;
  line-height: 1.4;
  font-size: 19px;
}

#chatPage .message.ai p {
  margin: 8px 0;
}

/* -------------------- Scroll Container -------------------- */
#chatPage .scroll-container {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  border-radius: 5px;
  padding: 20px 15px;
  margin-top: 20px;
  scrollbar-width: thin;
  scroll-behavior: smooth;
  background-color: #eeeeee;
}

/* -------------------- Scrollbar -------------------- */
#chatPage .scroll-container::-webkit-scrollbar {
  height: 10px;
}
#chatPage .scroll-container::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 10px;
}
#chatPage .scroll-container::-webkit-scrollbar-thumb {
  background-color: #bbb;
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
  transition: background 0.3s, transform 0.2s;
}
#chatPage .scroll-container::-webkit-scrollbar-thumb:hover {
  background-color: #888;
  transform: scaleY(1.2);
}

/* -------------------- Cards -------------------- */
#chatPage .card {
  min-width: 175px;
  background: white;
  overflow: hidden;
  flex-shrink: 0;
  padding: 10px;
  transition: transform 0.25s, box-shadow 0.25s;
}

#chatPage .card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
}

/* -------------------- Product Image -------------------- */
#chatPage .product-image img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: #f9f9f9;
  transition: transform 0.3s;
  outline: none;
}

#chatPage .card:hover .product-image img {
  transform: scale(1.05);
}

/* -------------------- Product Info -------------------- */
#chatPage .product-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#chatPage .product-name {
  font-size: 1rem;
  font-weight: 550;
  color: rgb(43, 43, 120);
  margin: 0;
}

#chatPage .product-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e53935;
  margin: 0;
}

#chatPage .product-details {
  font-size: 0.82rem;
  color: #555;
  margin-top: -2px !important;
  padding-top: 0;
}

#chatPage .product-name,
#chatPage .product-price,
#chatPage .product-details {
  margin: 0;
  padding: 0;
  line-height: 1;
  margin-left: -8px !important;
}

/* -------------------- Scroll Buttons -------------------- */
#chatPage .scroll-btns {
  gap: 20px;
  display: flex;
}

#chatPage .scroll-btns .scroll-add-btn {
  width: 60%;
  color: white;
  background-color: black;
  height: 30px;
  font-weight: 500;
  outline: none;
  border: none;
  border-radius: 5px;
}

#chatPage .scroll-btns .scroll-order-btn {
  width: 60%;
  color: white;
  background-color: rgb(255, 151, 5);
  height: 30px;
  font-weight: 500;
  outline: none;
  border: none;
  border-radius: 5px;
}

/* -------------------- Spinner -------------------- */
#chatPage .spinner-container {
  display: flex;
  gap: 4px;
  margin-bottom: 5px;
}

#chatPage .spinner-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  animation: bounce 1s infinite alternate;
}

#chatPage .spinner-dot:nth-child(2) {
  animation-delay: 0.2s;
}
#chatPage .spinner-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  to {
    transform: translateY(-8px);
  }
}

/* -------------------- Input Area -------------------- */
#chatPage #inputArea {
  display: flex;
  padding: 0px 10px;
  border-radius: 10px;
  background: white;
  margin: 20px; /* ✅ fixed bottom spacing */
}

#chatPage #userInput {
  flex: 1;
  padding: 12px 15px;
  border-radius: 20px;
  outline: none;
  background: white;
  font-size: 16px;
  border: 2px solid gainsboro;
}

#chatPage #userInput:focus {
  border: 2px solid gainsboro !important; /* ya jo color tu chahe */
  outline: none;
}

#chatPage #sendBtn {
  padding: 0px 20px;
  margin-left: 10px;
  border-radius: 5px;
  border: none;
  background: rgb(255, 151, 5);
  color: white;
  cursor: pointer;
}

#chatPage #sendBtn:disabled {
  opacity: 0.7;
}

/* -------------------- Error Container -------------------- */
#chatPage .error-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  font-size: 0.95rem;
  color: #555;
}

#chatPage .error-text {
  color: #555;
  text-align: center;
}

#chatPage .resend-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 1.2rem;
  transition: color 0.3s, transform 0.2s;
}

#chatPage .resend-btn:hover {
  color: #555;
  transform: translateY(-2px);
}

/* ✅ Only apply pre-wrap to pure text inside messages */
.message.ai:not(:has(.scroll-container)),
.message.user {
  white-space: pre-wrap;      /* preserve text spacing */
  word-break: break-word;     /* long lines wrap */
}

/* ✅ AI messages that have product cards behave normal */
.message.ai:has(.scroll-container) {
  white-space: normal;        /* normal spacing for cards */
}

/* -------------------- Welcome Screen -------------------- */
/* -------------------- 🌟 Clean Welcome Screen -------------------- */
#chatContainer {
  position: relative; /* welcomeScreen ko chat ke andar rakhne ke liye */
  overflow: hidden;
}

#welcomeScreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 65px); /* niche input area ke liye space chhoda */
  background: linear-gradient(145deg, #fffaf3, #ffffff);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border-radius: 10px 10px 0 0;
  color: #333;
  z-index: 10;
  overflow: hidden;
  opacity: 1;                  /* 👈 initially fully visible */
  transform: none;             /* no animation on load */
  transition: opacity 0.8s ease, transform 0.8s ease;
}

/* 🌀 Hide animation (only when send button clicked) */
#welcomeScreen.hide {
  opacity: 0;
  transform: translateY(20px) scale(0.96);  /* smooth fade + slight slide */
  pointer-events: none;
}

/* 🌈 Text styling */
#welcomeScreen h1 {
  font-size: 1.9rem;
  margin-bottom: 8px;
  font-weight: 700;
  background-image: linear-gradient(90deg, #ff9800, #ff7a00);
  background-clip: text;
  color: transparent;
  letter-spacing: 0.5px;
  text-shadow: 0 0 8px rgba(255, 153, 0, 0.25);
  animation: glowText 1.8s ease-in-out infinite alternate;
}

#welcomeScreen p {
  font-size: 1rem;
  line-height: 1.6;
  color: #555;
  margin: 4px 0;
}

/* ✨ Glow effect for heading */
@keyframes glowText {
  from { text-shadow: 0 0 5px rgba(255, 140, 0, 0.2); }
  to   { text-shadow: 0 0 12px rgba(255, 140, 0, 0.4); }
}

/* -------------------- 🧭 Left Info Panel -------------------- */
/* -------------------- 🌟 Left Info Panel (Final Polished Version) -------------------- */
#leftPanel {
  position: fixed;
  left: 40px;
  top: 80px;
  width: 350px; /* ✅ thoda wide */
  height: calc(100vh - 100px);
  background: none; /* clean, no background */
  border-right: 2px solid rgba(0, 0, 0, 0.08); /* subtle divider line */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 25px 20px;
  color: #333;
  line-height: 1.6;
}

/* 🌟 Logo Section */
#leftPanel .logo h2 {
  font-size: 1.9rem;
  font-weight: 700;
  background-image: linear-gradient(90deg, #ff9800, #ff7a00);
  background-clip: text;
  color: transparent;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

#leftPanel .logo p {
  font-size: 1rem;
  color: #555;
  font-weight: 500;
}

/* 💬 Info Section */
#leftPanel .info p {
  font-size: 0.95rem;
  color: #444;
  margin-top: 15px;
  font-weight: 400;
}

/* 🤝 Trust Section */
#leftPanel .trust h4 {
  font-size: 1.05rem;
  color: #ff7a00;
  margin-bottom: 8px;
  font-weight: 600;
}

#leftPanel .trust ul {
  list-style: none;
  padding-left: 0;
  margin-top: 4px;
}

#leftPanel .trust li {
  font-size: 0.9rem;
  color: #555;
  margin: 5px 0;
  padding-left: 14px;
  position: relative;
}

#leftPanel .trust li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #ff9800;
  font-weight: bold;
}

/* ❤️ Footer Section (polished look) */
#leftPanel .footer {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-top: 12px;
  margin-top: 15px;
  border-radius: 10px;
}

#leftPanel .footer p {
  font-size: 0.88rem;
  color: #666; /* ✅ changed from blackish to soft grey */
  text-align: left;
  letter-spacing: 0.3px;
}

/* 💻 Responsive Adjustments */
@media (max-width: 1024px) {
  #leftPanel {
    width: 250px;
    left: 20px;
  }
}

@media (max-width: 768px) {
  #leftPanel {
    display: none; /* ✅ hide on mobile/tablet */
  }
}

/* -------------------- Responsive -------------------- */
@media (max-width: 1024px) {
  #chatPage #chatContainer {
    width: 90%;
    margin-left: 250px;
    margin-right: 40px;
    height: calc(100vh - 60px);
    padding-right: 30px;
    padding-left: 30px;
  }

  #chatPage #inputArea {
    margin: 8px;
  }
}

@media (max-width: 768px) {
  #chatPage #chatContainer {
    width: 95%;
    margin-left: auto;
    margin-right: auto;
    height: calc(100vh - 60px);
    padding: 10px;
  }

  #chatPage #inputArea {
    margin: 8px;
  }

  /* ✅ Scoped Navbar Fix: only affects chat page */
  #chatPage .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  #chatPage .left-side,
  #chatPage .right-side {
    width: 100%;
    justify-content: flex-start;
    gap: 15px;
  }

  #chatPage .nav-links {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  #chatPage .search-container {
    width: 40%;
  }

  #chatPage .search-container input {
    width: 100%;
  }
}

@media (max-width: 480px) {
  #chatPage #chatContainer {
    width: 98%;
    margin-left: auto;
    margin-right: auto;
    height: calc(100vh - 120px);
    padding: 0px;
    border-radius: 5px;
  }

  body {
    overflow: hidden;
    overscroll-behavior-y: contain;
  }

  #chatPage #inputArea {
    margin: 8px;
  }

  #chatPage .message.ai {
    padding: 6px 11px;
    margin-left: -15px;
    margin-right: -14px;
    width: 108%;
  }

  #chatPage .message.user {
    margin-right: -15px;
  }
}

/* -------------------- Responsive Tweaks -------------------- */
@media screen and (max-width: 768px) {
  #chatPage .scroll-container {
    padding: 15px 10px;
    gap: 15px;
  }

  #chatPage .card {
    min-width: 200px;
    padding: 18px 12px;
    min-height: 150px;
  }
}
