/* ================ BASE STYLES ================ */
:root {
  --primary-purple: #5E35B1;
  --dark-purple: #4527A0;
  --light-purple: #7E57C2;
  --accent-purple: #B388FF;
  --black: #bbbb; 
  --dark-gray: #1E1E1E;
  --medium-gray: #2D2D2D;
  --light-gray: #424242;
  --white: #F5F5F5;
  --success: #4CAF50;
  --warning: #FFC107;
  --error: #F44336;
}

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

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

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--black);
  color: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================ APP CONTAINER ================ */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  background-color: var(--black);
  box-shadow: 0 0 30px rgba(93, 53, 177, 0.2);
  position: relative;
  overflow: hidden;
}

.app-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-purple), var(--accent-purple));
  z-index: 10;
}

/* ================ HEADER STYLES ================ */
.app-header {
  background-color: var(--dark-gray);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--light-gray);
  position: relative;
  z-index: 5;
}

.branding {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  position: relative;
  width: 40px;
  height: 40px;
  background-color: var(--primary-purple);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 1.2rem;
  box-shadow: 0 0 15px rgba(93, 53, 177, 0.5);
}

.logo .pulse {
  position: absolute;
  color: var(--accent-purple);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.app-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-purple), var(--primary-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.app-header h1 span {
  font-weight: 300;
}

.tagline {
  font-size: 0.8rem;
  color: var(--light-purple);
  margin-top: 0.2rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--white);
}

.status-dot {
  width: 10px;
  height: 10px;
  background-color: var(--success);
  border-radius: 50%;
  animation: blink 2s infinite;
}

@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* ================ CHAT CONTAINER ================ */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--dark-gray);
  position: relative;
  overflow: hidden;
}

.chat-window {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-purple) var(--dark-gray);
  background: linear-gradient(
    135deg,
    var(--black) 0%,
    var(--dark-gray) 100%
  );
}

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

.chat-window::-webkit-scrollbar-track {
  background: var(--dark-gray);
}

.chat-window::-webkit-scrollbar-thumb {
  background-color: var(--primary-purple);
  border-radius: 4px;
}

/* ================ WELCOME MESSAGE ================ */
.welcome-message {
  background-color: rgba(30, 30, 30, 0.8);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  border-left: 4px solid var(--primary-purple);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
}

.welcome-content h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--accent-purple), var(--primary-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.welcome-content p {
  margin-bottom: 1.5rem;
  color: var(--white);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.feature-card {
  background-color: var(--medium-gray);
  padding: 1.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  border-bottom: 3px solid var(--primary-purple);
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  background-color: var(--light-gray);
}

.feature-card i {
  font-size: 1.8rem;
  color: var(--accent-purple);
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--white);
}

.feature-card p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

.cta-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent-purple);
  text-align: center;
  margin-top: 2rem;
}

/* ================ MESSAGE STYLES ================ */
.message {
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
  position: relative;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.message-content {
  padding: 1rem 1.5rem;
  border-radius: 12px;
  max-width: 85%;
  position: relative;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-time {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.3rem;
  text-align: right;
}

.user-message {
  display: flex;
  justify-content: flex-end;
}

.user-message .message-content {
  background-color: var(--primary-purple);
  color: white;
  border-top-right-radius: 4px;
}

.user-message .message-content::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 0;
  width: 0;
  height: 0;
  border: 10px solid transparent;
  border-left-color: var(--primary-purple);
  border-right: 0;
  border-top: 0;
  margin-top: 10px;
  margin-right: -8px;
}

.ai-message {
  display: flex;
  justify-content: flex-start;
}

.ai-message .message-content {
  background-color: var(--medium-gray);
  color: var(--white);
  border-top-left-radius: 4px;
}

.ai-message .message-content::after {
  content: '';
  position: absolute;
  left: -8px;
  top: 0;
  width: 0;
  height: 0;
  border: 10px solid transparent;
  border-right-color: var(--medium-gray);
  border-left: 0;
  border-top: 0;
  margin-top: 10px;
  margin-left: -8px;
}

.ai-message .message-content strong {
  color: var(--accent-purple);
}

/* ================ TYPING INDICATOR ================ */
.typing-indicator {
  padding: 1rem 1.5rem;
  background-color: var(--medium-gray);
  border-radius: 12px;
  display: inline-block;
  max-width: 85%;
  border-top-left-radius: 4px;
}

.typing-dots {
  display: flex;
  align-items: center;
  height: 24px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-purple);
  border-radius: 50%;
  margin-right: 4px;
  animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes typingAnimation {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ================ INPUT AREA ================ */
.input-container {
  background-color: var(--dark-gray);
  padding: 1rem 2rem;
  border-top: 1px solid var(--light-gray);
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.input-box {
  display: flex;
  align-items: center;
  background-color: var(--medium-gray);
  border-radius: 24px;
  padding: 0.5rem 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--light-gray);
  transition: all 0.3s ease;
}

.input-box:focus-within {
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 2px rgba(94, 53, 177, 0.3);
}

#userInput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--white);
  padding: 0.5rem;
  font-size: 1rem;
  outline: none;
  resize: none;
  max-height: 150px;
  min-height: 40px;
}

#userInput::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.send-button {
  background-color: var(--primary-purple);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 0.5rem;
}

.send-button:hover {
  background-color: var(--dark-purple);
  transform: scale(1.05);
}

.send-button:active {
  transform: scale(0.95);
}

.send-button i {
  font-size: 1rem;
}

.input-hint {
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ================ FOOTER ================ */
.app-footer {
  background-color: var(--dark-gray);
  padding: 1rem 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  border-top: 1px solid var(--light-gray);
}

.app-footer i {
  margin: 0 0.2rem;
}

/* ================ MOBILE STYLES ================ */
@media (max-width: 768px) {
  .app-header {
    padding: 0.8rem 1rem;
  }
  
  .logo {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  .app-header h1 {
    font-size: 1.2rem;
  }
  
  .tagline {
    display: none;
  }
  
  .chat-window {
    padding: 1rem;
  }
  
  .welcome-message {
    padding: 1.5rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .input-container {
    padding: 1rem;
  }
  
  .input-box {
    padding: 0.5rem;
  }
  
  body.is-mobile .chat-window {
    padding-bottom: 80px;
  }
}

/* ================ ANIMATIONS & EFFECTS ================ */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

.glow {
  text-shadow: 0 0 10px rgba(179, 136, 255, 0.7);
}

/* ================ UTILITY CLASSES ================ */
.hidden {
  display: none !important;
}

.text-purple {
  color: var(--primary-purple);
}

.text-accent {
  color: var(--accent-purple);
}

.bg-purple {
  background-color: var(--primary-purple);
}

.bg-dark {
  background-color: var(--dark-gray);
}

/* ================ SPECIAL ELEMENTS ================ */
::selection {
  background-color: var(--accent-purple);
  color: white;
}

/* ================ LOADING STATES ================ */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent-purple);
  animation: spin 1s ease-in-out infinite;
  margin: 2rem auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}