/* Base Styles and Layout */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ai-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app-container {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#initial-view {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  transition: opacity 0.4s ease-out;
  position: relative;
  overflow: hidden;
}

/* Fluid Neon Border Animation - Main Layer */
#initial-view::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 8px;
  background: radial-gradient(ellipse at center, 
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.3) 30%,
    rgba(255, 255, 255, 0.15) 60%,
    transparent 100%);
  box-shadow: 
    0 -15px 60px rgba(255, 255, 255, 0.25),
    0 -30px 90px rgba(255, 255, 255, 0.15),
    0 -45px 120px rgba(255, 255, 255, 0.08);
  animation: 
    fluidWave 4.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite,
    fluidGlow 3.5s ease-in-out infinite,
    fluidPulse 2.8s ease-in-out infinite;
  border-radius: 60% 60% 0 0 / 80% 80% 0 0;
  filter: blur(4px);
  pointer-events: none;
}

/* Additional fluid layers for depth and physics simulation */
#initial-view::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 95%;
  height: 10px;
  background: radial-gradient(ellipse at center, 
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.2) 35%,
    rgba(255, 255, 255, 0.1) 65%,
    transparent 100%);
  box-shadow: 
    0 -12px 50px rgba(255, 255, 255, 0.2),
    0 -25px 80px rgba(255, 255, 255, 0.12),
    0 -40px 110px rgba(255, 255, 255, 0.06);
  animation: 
    fluidWave 3.1s cubic-bezier(0.42, 0, 0.58, 1) infinite reverse,
    fluidRipple 2.4s ease-in-out infinite 0.5s,
    fluidPulse 3.3s ease-in-out infinite 0.6s;
  border-radius: 55% 55% 0 0 / 75% 75% 0 0;
  filter: blur(6px);
  pointer-events: none;
}

#initial-view .header {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 24px;
  animation: introFadeScale 1.2s ease-in-out forwards;
}

#input-section-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#chat-view {
  height: 100%;
  display: none;
  flex-direction: column;
}

#chat-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  width: 100%;
  max-width: 60%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Message Styles */
.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
  word-wrap: break-word;
  animation: fadeInUp 220ms ease;
}

.message.user {
  align-self: flex-end;
  background: var(--user-bg);
  color: var(--user-text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
}

.message.ai {
  align-self: flex-start;
  background: transparent;
  color: var(--ai-text);
  font-size: 14px;
}

.ai .ai-body {
  padding: 10px 14px;
  border-radius: 6px;
  line-height: 1.45;
  word-break: break-word;
}

.ai .ai-body blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background-color: rgba(155, 220, 255, 0.05);
  color: var(--muted);
}

.ai .ai-body a {
  color: var(--accent);
  text-decoration: underline;
}

.ai .ai-body h1, .ai .ai-body h2, .ai .ai-body h3 {
  margin: 8px 0;
}

/* Code Block Styles */
.ai .ai-body pre {
  position: relative;
  background: var(--code-bg);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  white-space: pre-wrap;
  word-break: normal;
  margin: 6px 0;
}

.ai .ai-body pre code {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", monospace;
  font-size: 13px;
  padding: 0;
  background: transparent;
  color: inherit;
  white-space: pre-wrap;
}

/* Responsive Design */
@media (max-width: 800px) {
  #chat-view-header, #chat-container, #input-bar, #final-actions-container {
    max-width: 100%;
    padding-left: 12px;
    padding-right: 12px;
  }
  #input-bar {
    gap: 8px;
  }
}
