/* ===== GOOGLE FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f2a;
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.08);
  --accent-1: #6c5ce7;
  --accent-2: #a29bfe;
  --accent-3: #00cec9;
  --accent-4: #fd79a8;
  --text-primary: #f0f0f8;
  --text-secondary: rgba(240, 240, 248, 0.6);
  --text-muted: rgba(240, 240, 248, 0.35);
  --bot-bubble: rgba(108, 92, 231, 0.12);
  --user-bubble: linear-gradient(135deg, #6c5ce7, #a29bfe);
  --shadow-glow: 0 0 40px rgba(108, 92, 231, 0.15);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box
}

html {
  scroll-behavior: smooth;
  font-size: 16px
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .35;
  animation: orbFloat 20s ease-in-out infinite;
}

.bg-orb:nth-child(1) {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #6c5ce7, transparent 70%);
  top: -10%;
  left: -5%;
  animation-duration: 22s;
}

.bg-orb:nth-child(2) {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #00cec9, transparent 70%);
  bottom: -10%;
  right: -5%;
  animation-duration: 18s;
  animation-delay: -5s;
}

.bg-orb:nth-child(3) {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #fd79a8, transparent 70%);
  top: 40%;
  left: 50%;
  animation-duration: 25s;
  animation-delay: -10s;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
}

@keyframes orbFloat {

  0%,
  100% {
    transform: translate(0, 0) scale(1)
  }

  25% {
    transform: translate(60px, -40px) scale(1.1)
  }

  50% {
    transform: translate(-30px, 50px) scale(0.95)
  }

  75% {
    transform: translate(40px, 20px) scale(1.05)
  }
}

/* ===== LAYOUT ===== */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 20px 0;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  margin-bottom: 16px;
  box-shadow: var(--shadow-glow);
  animation: slideDown .6s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px)
  }

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

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px
}

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3)
  }

  50% {
    box-shadow: 0 4px 30px rgba(108, 92, 231, 0.5)
  }
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.3px
}

.brand-text span {
  font-size: .72rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: .5px;
  text-transform: uppercase
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--accent-3)
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-3);
  animation: blink 2s ease-in-out infinite
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .3
  }
}

.header-actions {
  display: flex;
  gap: 8px
}

.header-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 16px;
}

.header-btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  transform: translateY(-1px)
}

/* ===== CHAT AREA ===== */
.chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  animation: fadeIn .8s ease-out .2s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px)
  }

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

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 5px
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px
}

/* ===== MESSAGES ===== */
.message {
  display: flex;
  gap: 12px;
  max-width: 82%;
  animation: msgIn .4s ease-out
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(12px)
  }

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

.message.bot {
  align-self: flex-start
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.message.bot .msg-avatar {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3))
}

.message.user .msg-avatar {
  background: linear-gradient(135deg, var(--accent-4), var(--accent-2))
}

.msg-content {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.msg-bubble {
  padding: 14px 18px;
  font-size: .9rem;
  line-height: 1.65;
  border-radius: var(--radius-md);
  position: relative;
  letter-spacing: .01em;
}

.message.bot .msg-bubble {
  background: var(--bot-bubble);
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
  color: var(--text-primary);
}

.message.user .msg-bubble {
  background: var(--user-bubble);
  border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
  color: #fff;
}

.msg-time {
  font-size: .68rem;
  color: var(--text-muted);
  padding: 0 4px
}

.message.user .msg-time {
  text-align: right
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  align-items: center
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: typeDot 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: .2s
}

.typing-indicator span:nth-child(3) {
  animation-delay: .4s
}

@keyframes typeDot {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: .4
  }

  30% {
    transform: translateY(-8px);
    opacity: 1
  }
}

/* ===== QUICK REPLIES ===== */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 16px;
}

.quick-btn {
  padding: 9px 18px;
  border-radius: 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: .78rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.quick-btn:hover {
  background: rgba(108, 92, 231, 0.15);
  border-color: var(--accent-1);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.2);
}

/* ===== INPUT AREA ===== */
.input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 20px 20px;
  background: rgba(15, 15, 42, 0.6);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 4px 6px 4px 18px;
  transition: var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

#userInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  padding: 12px 0;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
}

#userInput::placeholder {
  color: var(--text-muted)
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4)
}

.send-btn:active {
  transform: scale(.95)
}

.send-btn:disabled {
  opacity: .4;
  cursor: default;
  transform: none;
  box-shadow: none
}

/* ===== WELCOME SCREEN ===== */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  flex: 1;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 24px;
  box-shadow: 0 8px 40px rgba(108, 92, 231, 0.3);
  animation: float 4s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-10px)
  }
}

.welcome h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome p {
  color: var(--text-secondary);
  font-size: .88rem;
  max-width: 400px;
  line-height: 1.6;
  margin-bottom: 28px
}

.welcome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 460px;
}

.welcome-card {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.welcome-card:hover {
  background: rgba(108, 92, 231, 0.1);
  border-color: rgba(108, 92, 231, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(108, 92, 231, 0.15);
}

.welcome-card .card-icon {
  font-size: 20px;
  margin-bottom: 8px
}

.welcome-card .card-title {
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: 4px
}

.welcome-card .card-desc {
  font-size: .7rem;
  color: var(--text-muted);
  line-height: 1.4
}

/* ===== SIDEBAR PANEL ===== */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

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

.sidebar {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  height: 100%;
  z-index: 100;
  background: rgba(15, 15, 42, 0.95);
  backdrop-filter: blur(30px);
  border-left: 1px solid var(--glass-border);
  transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.sidebar.active {
  right: 0
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h3 {
  font-size: 1rem;
  font-weight: 600
}

.sidebar-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition);
}

.sidebar-close:hover {
  background: var(--glass-hover);
  color: var(--text-primary)
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px
}

.faq-category {
  margin-bottom: 24px
}

.faq-category h4 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.faq-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.faq-item:hover {
  background: rgba(108, 92, 231, 0.1);
  border-color: rgba(108, 92, 231, 0.3);
  color: var(--text-primary);
  transform: translateX(-3px);
}

/* ===== RESPONSIVE ===== */
@media(max-width:640px) {
  .app-container {
    padding: 10px 10px 0
  }

  .header {
    padding: 12px 16px;
    border-radius: var(--radius-md)
  }

  .brand-text h1 {
    font-size: 1rem
  }

  .chat-messages {
    padding: 20px 14px
  }

  .message {
    max-width: 90%
  }

  .welcome-grid {
    grid-template-columns: 1fr
  }

  .input-area {
    padding: 12px 14px 16px
  }

  .sidebar {
    width: min(320px, 85vw)
  }
}