@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Orbitron:wght@500;700;900&display=swap');

:root {
  --bg-color: #05060A;
  --bg-secondary: #0B0F1A;
  --text-dim: #555555;
  --text-mid: #999999;
  --text-bright: #ffffff;
  --accent: #111111;
  --border-color: rgba(255, 255, 255, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

/* Futuristic Neon Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #7000ff, #00d4ff);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #00d4ff;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background-color: #000000;
  color: var(--text-bright);
  font-family: 'Inter', sans-serif;
}

#landing-page {
  /* Reduced glow coverage for a more elegant look */
  box-shadow: inset 0 0 150px rgba(255, 255, 255, 0.1);
  position: relative;
}

#landing-page::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
    /* Weaker, softer radial mist */
    background: radial-gradient(circle at center, transparent 60%, rgba(255,255,255,0.08) 120%);
}

#dna-canvas, #cosmic-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out; /* Fast, crisp transition */
}

.view {
  position: relative;
  z-index: 10;
  display: none;
  min-height: 100vh;
  width: 100%;
}

.view.active {
  display: flex;
}

/* --- LANDING PAGE --- */
.container {
  flex-direction: column;
  padding: 40px 10%; /* More balanced padding */
  align-items: center; /* Center horizontally */
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 20px;
  gap: 16px;
  font-family: 'Orbitron', sans-serif;
  z-index: 10;
}

.dot {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: white;
}

/* Logo DOT positioning to mimic Power AI */
.d1 { top: 0; left: 50%; transform: translateX(-50%); background: #ff4757; }
.d2 { top: 15%; right: 15%; background: #ff7f50; }
.d3 { top: 50%; right: 0; transform: translateY(-50%); background: #ffa502; }
.d4 { bottom: 15%; right: 15%; background: #2ed573; }
.d5 { bottom: 0; left: 50%; transform: translateX(-50%); background: #1e90ff; }
.d6 { bottom: 15%; left: 15%; background: #3742fa; }
.d7 { top: 50%; left: 0; transform: translateY(-50%); background: #9c88ff; }
.d8 { top: 15%; left: 15%; background: #ff4757; }


.btn-launch, .btn-enter {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 10px 24px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-launch:hover, .btn-enter:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    height: 100%;
    left: -280px;
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    z-index: 1000;
  }

  .sidebar.active {
    left: 0;
  }

  .mobile-controls {
    display: flex;
  }

  .navbar {
    width: 100%;
    padding: 0 20px;
  }

  .hero-title {
    font-size: 3rem !important; /* Force smaller size on phone */
  }
  
  .hero-desc {
    font-size: 0.95rem;
    padding: 0 20px;
  }

  .input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px 10px 20px;
    background: #05060A;
    z-index: 100;
  }

  .input-wrapper {
    width: 95%;
    margin: 0 auto;
  }

  .chat-feed {
    padding: 80px 15px 100px; /* Extra bottom padding so messages aren't hidden by the input bar */
  }

  .message {
    max-width: 95% !important;
    font-size: 14px !important;
  }
  
  .message-wrapper.user .message {
    max-width: 85%;
  }
  
  .sidebar-header {
      padding: 15px;
  }
  
  .container {
      padding: 20px 5%;
  }
}

/* CSS Animations */
@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(40px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 10px rgba(255,255,255,0.1); transform: scale(1); }
  50% { box-shadow: 0 0 25px rgba(255,255,255,0.4); transform: scale(1.02); }
  100% { box-shadow: 0 0 10px rgba(255,255,255,0.1); transform: scale(1); }
}

.animate-up {
  opacity: 0;
  animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.delay-1 { animation-delay: 0.3s; }
.delay-2 { animation-delay: 0.6s; }

.hero {
  margin-top: 15vh;
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center; /* Centering */
  text-align: center;
}

.hero-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 6.5rem; /* Scaled up */
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 900;
  margin-bottom: 40px;
  background: linear-gradient(180deg, #ffffff 0%, #7B61FF 100%); /* Adds sci-fi neon touch */
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(123, 97, 255, 0.2);
}

.hero-actions {
  display: flex;
  gap: 24px;
  margin-bottom: 30px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-enter, .btn-guest {
  padding: 18px 40px;
  font-size: 18px;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-guest {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
}

.btn-guest:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #7000ff;
}

/* File Previews */
.file-previews {
  display: flex;
  gap: 12px;
  padding: 0 16px 12px;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto;
}

.file-preview-card {
  background: rgba(112, 0, 255, 0.1);
  border: 1px solid rgba(112, 0, 255, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeUp 0.3s ease-out;
}

.file-preview-card .remove-btn {
  background: none;
  border: none;
  color: #ff4757;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.input-area.drag-over {
  background: rgba(112, 0, 255, 0.05);
  border-top: 1px dashed #7000ff;
}

.pulse-btn {
  animation: pulseGlow 3s infinite ease-in-out;
}

.pulse-btn:hover {
  animation: none;
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(255,255,255,0.6);
}

.btn-signup {
  background: #ffffff;
  color: #000000;
}

.btn-signup:hover {
  background: #dddddd;
  color: #000000;
}

.hero-desc {
  color: var(--text-mid);
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 500px;
}


/* --- CHAT INTERFACE --- */
#app-view {
  flex-direction: row;
  height: 100%;
  width: 100%;
  background-color: transparent;
  position: relative;
  overflow: hidden;
}

#app-view::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  
  background: 
    /* 1. Solid minimalist black bottom half with glowing arched horizon line */
    radial-gradient(
      ellipse 150% 60% at 50% 100%, 
      #000000 50%, 
      rgba(255, 255, 255, 0.5) 51%, 
      rgba(200, 220, 255, 0.15) 54%, 
      transparent 65%
    ),
    /* 2. Soft foggy white mist transitioning to transparent in top half */
    radial-gradient(
      circle at 50% 40%, 
      rgba(255, 255, 255, 0.08) 0%, 
      rgba(100, 110, 130, 0.03) 40%, 
      transparent 80%
    );
}

#app-view > * {
  z-index: 1; /* Keep UI above the CSS glow */
}

.sidebar {
  width: 280px;
  height: 100%;
  background: rgba(5, 6, 10, 0.6);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar.collapsed * {
  opacity: 0;
  pointer-events: none;
}

.btn-new-chat-prominent {
  background: linear-gradient(135deg, rgba(112, 0, 255, 0.2), rgba(0, 212, 255, 0.2));
  border: 1px solid rgba(112, 0, 255, 0.4);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.3s ease;
  flex: 1;
  justify-content: center;
}

.btn-new-chat-prominent:hover {
  background: linear-gradient(135deg, rgba(112, 0, 255, 0.4), rgba(0, 212, 255, 0.4));
  border-color: #7000ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(112, 0, 255, 0.2);
}

.toggle-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: #7000ff;
}

.sidebar-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-new-chat {
  padding: 0 24px 16px;
}

.btn-new-chat {
  width: 100%;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  color: white;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-top: 20px;
}

.btn-new-chat:hover { background: rgba(255,255,255,0.1); }

.search-box {
  padding: 0 24px 16px;
}

.search-box input {
  width: 100%;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  color: white;
  border-radius: 6px;
  font-family: inherit;
  outline: none;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px;
}

.chat-item {
  position: relative;
  padding: 12px 16px;
  padding-right: 40px; 
  margin: 4px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
}

.chat-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  transform: translateX(4px);
}

.menu-dots {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.3);
  opacity: 0;
  transition: all 0.2s;
  border-radius: 4px;
  z-index: 5;
}

.chat-item:hover .menu-dots { opacity: 1; }
.menu-dots:hover { background: rgba(255, 255, 255, 0.1); color: white; }

/* Context Menu */
.context-menu {
  position: fixed;
  background: rgba(13, 14, 20, 0.95);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(15px);
  border-radius: 12px;
  padding: 8px;
  min-width: 150px;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: menuIn 0.2s ease-out;
}

@keyframes menuIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.menu-item {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: 0.2s;
}

.menu-item:hover {
  background: rgba(255,255,255,0.05);
  color: white;
}

.menu-item.delete:hover {
  background: rgba(255, 71, 87, 0.2);
  color: #ff4757;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-content {
  background: #0D0E14;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 30px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.modal-title { font-size: 1.2rem; margin-bottom: 20px; color: white; }
.modal-msg { color: rgba(255,255,255,0.6); margin-bottom: 30px; font-size: 14px; }

.modal-actions { display: flex; gap: 12px; justify-content: center; }
.modal-btn {
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: 0.2s;
}

.modal-btn.cancel { background: #1A1B23; color: white; }
.modal-btn.confirm { background: #7000ff; color: white; }
.modal-btn.delete { background: #ff4757; color: white; }

.modal-input {
    width: 100%;
    background: #1A1B23;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    outline: none;
}

.chat-item.active {
  background: rgba(112, 0, 255, 0.15);
  color: #fff;
  border-color: rgba(112, 0, 255, 0.3);
  box-shadow: 0 0 15px rgba(112, 0, 255, 0.1);
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
}

.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-meta span { font-size: 14px; font-weight: 500;}
.user-meta .status { font-size: 12px; color: var(--text-mid); }


.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-black);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
  height: 100vh; /* Lock height to view port */
  overflow: hidden; /* Prevent main container from scrolling */
}

.chat-header {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 50;
  display: flex;
  align-items: center;
}

.floating-toggle {
  background: rgba(43, 44, 51, 0.8);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-toggle:hover {
  background: rgba(112, 0, 255, 0.2);
  border-color: #7000ff;
}

.mobile-controls {
  display: none;
  width: 100vw;
  padding: 12px 16px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
}
.chat-feed {
  flex: 1;
  padding: 80px 20px 40px; /* Space for header and bottom padding */
  width: 100%;
  overflow-y: auto; /* Enable scrolling here */
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 100%; /* Ensure it doesn't expand parent */
}

.welcome-msg {
  margin: auto;
  text-align: center;
}

.welcome-msg h2 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.welcome-msg p {
  color: var(--text-mid);
}

.message-wrapper {
  display: flex;
  width: 100%;
  max-width: 900px; /* Center the bubbles structurally */
  margin: 0 auto;
}

.message-wrapper.user {
  justify-content: flex-end;
}

.message {
  line-height: 1.7;
  font-size: 15.5px;
  font-weight: 400;
  word-wrap: break-word; /* Ensure long strings wrap */
}

/* Markdown parsing overrides for AI text */
.message h1, .message h2, .message h3 { margin-bottom: 0.5em; margin-top: 0.5em; font-weight: 600; color: white; }
.message h3 { font-size: 1.1em; }
.message p { margin-bottom: 0.8em; }
.message p:last-child { margin-bottom: 0; }
.message ul, .message ol { margin-left: 1.5em; margin-bottom: 0.8em; }
.message li { margin-bottom: 0.3em; }
.message strong { font-weight: 600; color: #fff; }
.message code { background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 0.9em; }
.message pre { background: rgba(0,0,0,0.5); padding: 16px; border-radius: 8px; overflow-x: auto; margin-bottom: 1em; border: 1px solid rgba(255,255,255,0.1); }
.message pre code { background: transparent; padding: 0; }

.user .message {
  max-width: 70%;
  padding: 16px 20px;
  background: rgba(255,255,255, 0.1);
  border-radius: 12px;
  border-bottom-right-radius: 4px;
}

.assistant {
  justify-content: flex-start;
}

.assistant .message {
  max-width: 100%;
  padding: 16px 0; /* Blend seamlessly into the background without a box */
  background: transparent;
  border: none;
}

.input-area {
  padding: 20px 24px 40px;
  width: 100%;
  z-index: 10;
  flex-shrink: 0;
  background: linear-gradient(0deg, #05060A 80%, transparent);
}

.input-wrapper {
  max-width: 900px;
  margin: 0 auto; /* Center input specifically */
  display: flex;
  background: rgba(20, 20, 20, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 12px;
  align-items: center;
}

.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  color: white;
  padding: 12px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}

.btn-send, .btn-upload {
  background: white;
  color: black;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-upload {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border: 1px solid var(--border-color);
  margin-right: 8px;
}

.btn-upload:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #7000ff;
}

.btn-send {
  background: white;
  color: black;
}

.engine-status {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 12px;
  letter-spacing: 0.5px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #555; }