/* ========================================
   Chat page — mimics the app's AI Mentor screen
   ======================================== */

.chat-page {
  min-height: 100vh;
  overflow-x: hidden;
}

.chat-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 100px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 100vh;
}

/* Demo banner */
.demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(184, 164, 216, 0.08);
  border: 1px solid rgba(184, 164, 216, 0.2);
  border-radius: 100px;
  font-size: 12px;
  color: var(--subtle-gray);
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}

.demo-badge {
  padding: 3px 10px;
  background: linear-gradient(135deg, var(--soft-purple), var(--teal-glow));
  color: var(--deep-navy);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 1.5px;
  border-radius: 100px;
}

/* Chat header (matches app screenshot exactly) */
.chat-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 24px 16px 32px;
  background: linear-gradient(180deg,
    rgba(11, 17, 24, 0.6) 0%,
    transparent 100%);
  border-radius: 24px 24px 0 0;
}

.chat-back, .chat-menu {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: var(--soft-white);
  cursor: pointer;
  transition: var(--transition-base);
  backdrop-filter: blur(10px);
}

.chat-back:hover, .chat-menu:hover {
  background: rgba(94, 234, 212, 0.1);
  border-color: rgba(94, 234, 212, 0.3);
  box-shadow: 0 0 16px rgba(94, 234, 212, 0.2);
}

.chat-header-center {
  text-align: center;
}

/* Lotus icon — exactly like app's LotusAvatar */
.chat-lotus {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(94, 234, 212, 0.55) 0%,
    rgba(184, 164, 216, 0.55) 50%,
    rgba(94, 234, 212, 0.15) 80%,
    transparent 100%);
  box-shadow:
    0 0 30px rgba(94, 234, 212, 0.5),
    0 0 60px rgba(184, 164, 216, 0.3),
    inset 0 0 16px rgba(255, 255, 255, 0.2);
  animation: lotusPulse 4s ease-in-out infinite;
  position: relative;
}

.lotus-emoji {
  font-size: 32px;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

@keyframes lotusPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 30px rgba(94, 234, 212, 0.5),
      0 0 60px rgba(184, 164, 216, 0.3),
      inset 0 0 16px rgba(255, 255, 255, 0.2);
  }
  50% {
    transform: scale(1.04);
    box-shadow:
      0 0 40px rgba(184, 164, 216, 0.6),
      0 0 80px rgba(94, 234, 212, 0.4),
      inset 0 0 20px rgba(255, 255, 255, 0.25);
  }
}

.chat-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--soft-white);
  margin: 0 0 4px 0;
  letter-spacing: 0.5px;
}

.chat-subtitle {
  font-size: 13px;
  font-style: italic;
  color: var(--subtle-gray);
  letter-spacing: 1px;
  margin: 0;
}

/* Chat messages area */
.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 8px 16px 32px;
  min-height: 400px;
}

/* Message rows */
.msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(20px);
  animation: msgIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.msg-row.user {
  flex-direction: row-reverse;
}

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

/* Avatar (lotus circle, matches app) */
.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  position: relative;
}

.msg-avatar.mentor {
  background: radial-gradient(circle,
    rgba(94, 234, 212, 0.55) 0%,
    rgba(94, 234, 212, 0.20) 60%,
    transparent 100%);
  box-shadow:
    0 0 16px rgba(94, 234, 212, 0.4),
    inset 0 0 8px rgba(255, 255, 255, 0.15);
}

.msg-avatar.user {
  background: radial-gradient(circle,
    rgba(184, 164, 216, 0.55) 0%,
    rgba(184, 164, 216, 0.20) 60%,
    transparent 100%);
  box-shadow:
    0 0 16px rgba(184, 164, 216, 0.4),
    inset 0 0 8px rgba(255, 255, 255, 0.15);
}

/* Bubble + timestamp wrapper */
.msg-content {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  gap: 6px;
}

.msg-row.user .msg-content {
  align-items: flex-end;
}

/* Chat bubble — exactly matches app's BubbleSurface */
.msg-bubble {
  padding: 14px 18px;
  border-radius: 22px;
  font-size: 15px;
  line-height: 22px;
  font-weight: 300;
  color: var(--soft-white);
  position: relative;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Mentor bubble — teal gradient (asymmetric like app) */
.msg-row.mentor .msg-bubble {
  background: linear-gradient(180deg,
    rgba(94, 234, 212, 0.32) 0%,
    rgba(94, 234, 212, 0.18) 100%);
  border: 1px solid rgba(94, 234, 212, 0.35);
  border-bottom-left-radius: 6px;
  box-shadow:
    0 8px 24px rgba(94, 234, 212, 0.15),
    inset 0 0 12px rgba(255, 255, 255, 0.05);
}

/* User bubble — purple gradient (asymmetric mirror) */
.msg-row.user .msg-bubble {
  background: linear-gradient(180deg,
    rgba(184, 164, 216, 0.55) 0%,
    rgba(184, 164, 216, 0.35) 100%);
  border: 1px solid rgba(184, 164, 216, 0.5);
  border-bottom-right-radius: 6px;
  box-shadow:
    0 8px 24px rgba(184, 164, 216, 0.2),
    inset 0 0 12px rgba(255, 255, 255, 0.08);
}

.msg-time {
  font-size: 11px;
  color: var(--subtle-gray);
  letter-spacing: 0.5px;
  padding: 0 8px;
}

/* Typing indicator (3 dots) */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  animation: typingDot 1.4s ease-in-out infinite;
}

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

@keyframes typingDot {
  0%, 60%, 100% {
    transform: scale(0.7);
    opacity: 0.5;
  }
  30% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chat input bar — matches app's input */
.chat-input-bar {
  padding: 16px 16px 8px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(11, 17, 24, 0.8) 30%,
    rgba(11, 17, 24, 0.95) 100%);
  backdrop-filter: blur(20px);
  z-index: 10;
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  padding: 6px 6px 6px 22px;
  backdrop-filter: blur(20px);
  transition: var(--transition-base);
}

.chat-input-wrap:focus-within {
  border-color: rgba(94, 234, 212, 0.4);
  box-shadow: 0 0 24px rgba(94, 234, 212, 0.15);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--soft-white);
  font-size: 15px;
  font-family: inherit;
  padding: 12px 0;
}

.chat-input::placeholder {
  color: var(--subtle-gray);
  font-weight: 300;
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg,
    rgba(184, 164, 216, 0.95),
    rgba(94, 234, 212, 0.95));
  color: var(--deep-navy);
  cursor: pointer;
  transition: var(--transition-base);
  flex-shrink: 0;
  box-shadow:
    0 4px 16px rgba(184, 164, 216, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.chat-send:hover {
  transform: scale(1.05);
  box-shadow:
    0 6px 24px rgba(184, 164, 216, 0.6),
    0 0 32px rgba(94, 234, 212, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.chat-send:active {
  transform: scale(0.96);
}

.chat-send svg {
  transform: translateX(-1px);
}

.chat-disclaimer {
  font-size: 11px;
  color: var(--subtle-gray);
  text-align: center;
  margin-top: 12px;
  padding: 0 16px;
  line-height: 1.5;
}

/* CTA section below chat */
.chat-cta-section {
  padding: 60px 20px 40px;
}

.chat-cta-card {
  text-align: center;
  padding: 40px 32px;
  background: linear-gradient(135deg,
    rgba(184, 164, 216, 0.08),
    rgba(94, 234, 212, 0.08));
  border: 1px solid rgba(184, 164, 216, 0.2);
  border-radius: 28px;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.chat-cta-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center,
    rgba(94, 234, 212, 0.1),
    transparent 70%);
  pointer-events: none;
}

.chat-cta-title {
  font-size: 28px;
  font-weight: 300;
  color: var(--soft-white);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.chat-cta-text {
  font-size: 15px;
  color: var(--subtle-gray);
  margin-bottom: 28px;
  line-height: 1.6;
}

.chat-cta-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Logged-in CTA variant — softer, lotus-led */
.chat-cta-card.chat-cta-user {
  background: linear-gradient(135deg,
    rgba(94, 234, 212, 0.10),
    rgba(184, 164, 216, 0.10));
  border-color: rgba(94, 234, 212, 0.25);
}

.chat-cta-lotus {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(94, 234, 212, 0.55) 0%,
    rgba(184, 164, 216, 0.55) 50%,
    rgba(94, 234, 212, 0.15) 80%,
    transparent 100%);
  box-shadow:
    0 0 30px rgba(94, 234, 212, 0.4),
    inset 0 0 14px rgba(255, 255, 255, 0.15);
  font-size: 32px;
  animation: ctaLotusPulse 4s ease-in-out infinite;
}

@keyframes ctaLotusPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Active nav link */
.nav-links a.active {
  color: var(--teal-glow) !important;
  border-color: rgba(94, 234, 212, 0.3) !important;
  background: rgba(94, 234, 212, 0.08) !important;
}

/* Mobile */
@media (max-width: 640px) {
  .chat-main {
    padding: 80px 12px 20px;
  }

  .chat-messages {
    padding: 8px 4px 20px;
    gap: 18px;
  }

  .msg-content {
    max-width: 80%;
  }

  .msg-bubble {
    font-size: 14px;
    padding: 12px 16px;
    border-radius: 18px;
  }

  .chat-title {
    font-size: 20px;
  }

  .chat-cta-buttons {
    flex-direction: column;
    align-items: stretch;
  }
}

/* RTL adjustments for Arabic */
body.rtl .msg-row {
  flex-direction: row-reverse;
}

body.rtl .msg-row.user {
  flex-direction: row;
}

body.rtl .msg-row.mentor .msg-bubble {
  border-bottom-left-radius: 22px;
  border-bottom-right-radius: 6px;
}

body.rtl .msg-row.user .msg-bubble {
  border-bottom-right-radius: 22px;
  border-bottom-left-radius: 6px;
}

body.rtl .chat-input-wrap {
  padding: 6px 22px 6px 6px;
}

body.rtl .chat-send svg {
  transform: scaleX(-1) translateX(-1px);
}
