/* CSS Variables - Terminal Theme */
:root {
  --primary: #00ff00;
  --secondary: #00cc00;
  --background: #0a0a23;
  --card: #1a1a3a;
  --border: #333366;
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --text-muted: #b0b0b0;
  --shadow: rgba(0, 0, 0, 0.3);
  --terminal-green: #00ff00;
  --terminal-blue: #0080ff;
}

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

html {
  font-family: 'Courier New', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

body {
  background-color: var(--background);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Header Logo */
.header-logo {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 140px;
  height: 60px;
  z-index: 20;
}

.header-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Utility Classes */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

/* Spacing */
.p-6 { padding: 1.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mx-4 { margin-left: 1rem; margin-right: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Sizing */
.w-9 { width: 2.25rem; }
.h-9 { height: 2.25rem; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-[85%] { max-width: 85%; }
.max-w-[70%] { max-width: 70%; }
.max-h-[80vh] { max-height: 80vh; }

/* Positioning */
.sticky { position: sticky; }
.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }

/* Display */
.hidden { display: none; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.overflow-y-scroll { overflow-y: scroll; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
/* Text Alignment Fix */
.text-left {
  text-align: left !important;
}

.whitespace-pre-wrap {
  white-space: pre-wrap;
  text-align: left !important;
}

.leading-relaxed {
  line-height: 1.625;
  text-align: left !important;
}

/* Colors - Terminal Theme */
.text-primary { color: #ffffff; }
.text-primary-button { color: var(--terminal-green); }
.text-gray-200 { color: #ffffff; }
.text-gray-300 { color: #ffffff; }
.text-gray-400 { color: #b0b0b0; }
.text-gray-500 { color: #909090; }
.text-white { color: white; }
.bg-background { background-color: var(--background); }
.bg-card { background-color: var(--card); }
.bg-white { background-color: var(--card); }
.bg-gray-800 { background-color: var(--card); }
.bg-gray-900 { background-color: var(--background); }
.bg-black\/50 { background-color: rgba(0, 0, 0, 0.7); }
.bg-primary\/10 { background-color: rgba(0, 255, 0, 0.1); }
.bg-white\/30 { background-color: rgba(255, 255, 255, 0.1); }

/* Borders */
.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.border-border { border-color: var(--border); }
.border-gray-700 { border-color: var(--border); }
.border-primary\/30 { border-color: rgba(0, 255, 0, 0.3); }
.border-primary\/50 { border-color: rgba(0, 255, 0, 0.5); }
.border-primary { border-color: var(--terminal-green); }

/* Border Radius */
.rounded-full { border-radius: 9999px; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-tl-md { border-top-left-radius: 0.375rem; }

/* Shadows */
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }
.shadow-glow { box-shadow: 0 0 10px rgba(0, 229, 219, 0.4); }

/* Gradients */
.bg-gradient-to-r { background-image: linear-gradient(to right, var(--tw-gradient-stops)); }
.bg-gradient-to-br { background-image: linear-gradient(to bottom right, var(--tw-gradient-stops)); }
.from-primary { --tw-gradient-from: var(--primary); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(0, 229, 219, 0)); }
.to-secondary { --tw-gradient-to: var(--secondary); }

/* Transitions */
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-opacity { transition-property: opacity; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.duration-500 { transition-duration: 500ms; }
.ease-out { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); }

/* Hover Effects */
.hover\:shadow-xl:hover { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }
.hover\:border-primary\/30:hover { border-color: rgba(0, 255, 0, 0.3); }
.hover\:border-primary\/50:hover { border-color: rgba(0, 255, 0, 0.5); }
.hover\:bg-primary\/10:hover { background-color: rgba(0, 255, 0, 0.1); }
.hover\:bg-primary:hover { background-color: var(--primary); }
.hover\:text-primary:hover { color: var(--primary); }
.hover\:text-white:hover { color: white; }
.hover\:shadow-glow:hover { box-shadow: 0 0 10px rgba(0, 255, 0, 0.4); }

/* Active Effects */
.active\:scale-\[0\.98\]:active { transform: scale(0.98); }

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.fade-in { animation: fadeIn 0.5s ease-in-out; }

/* Responsive Design - Mobile First */

/* Mobile (320px - 639px) */
@media (max-width: 639px) {
  .header-logo {
    width: 100px;
    height: 40px;
    top: 0.5rem;
    left: 0.5rem;
  }
  
  .chat-bubble {
    max-width: 95%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    max-height: 60vh;
    overflow-y: auto;
  }
  
  .answer-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    min-height: 40px;
  }
  
  .avatar {
    width: 1.75rem;
    height: 1.75rem;
    margin-right: 0.5rem;
  }
  
  .progress-bar {
    height: 0.5rem;
  }
  
  .terminal-glow {
    /* Glow effect removed for mobile */
  }
  
  /* Mobile chat container optimization */
  #chat-container {
    padding: 0.5rem;
    min-height: calc(100vh - 200px);
  }
  
  /* Mobile header optimization */
  .sticky.top-0 {
    padding: 0.5rem 0.75rem;
  }
  
  /* Mobile answer section optimization */
  .sticky.bottom-0 {
    padding: 0.75rem;
  }
}

/* Small Mobile (480px - 639px) */
@media (min-width: 480px) and (max-width: 639px) {
  .header-logo {
    width: 120px;
    height: 50px;
  }
  
  .chat-bubble {
    max-width: 90%;
    padding: 0.6rem 0.8rem;
  }
  
  .answer-button {
    padding: 0.6rem 0.8rem;
    min-height: 42px;
  }
}

/* Tablet (640px - 1023px) */
@media (min-width: 640px) {
  .sm\:px-4 { padding-left: 1rem; padding-right: 1rem; }
  .sm\:py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .sm\:py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
  .sm\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
  .sm\:gap-2 { gap: 0.5rem; }
  .sm\:mb-3 { margin-bottom: 0.75rem; }
  .sm\:h-2\.5 { height: 0.625rem; }
  .sm\:py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .sm\:px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
  .sm\:min-h-0 { min-height: 0; }
  .sm\:opacity-0 { opacity: 0; }
  
  .header-logo {
    width: 140px;
    height: 60px;
    top: 0.75rem;
    left: 0.75rem;
  }
  
  .chat-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  .answer-button {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    min-height: 44px;
  }
  
  .avatar {
    width: 2rem;
    height: 2rem;
    margin-right: 0.6rem;
  }
}

/* Desktop (768px - 1279px) */
@media (min-width: 768px) {
  .md\:max-w-\[70\%\] { max-width: 70%; }
  .md\:flex { display: flex; }
  
  .header-logo {
    width: 160px;
    height: 70px;
    top: 1rem;
    left: 1rem;
  }
  
  .chat-bubble {
    max-width: 80%;
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
  }
  
  .answer-button {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    min-height: 48px;
  }
  
  .avatar {
    width: 2.25rem;
    height: 2.25rem;
    margin-right: 0.75rem;
  }
  
  .progress-bar {
    height: 0.75rem;
  }
  
  .terminal-glow {
    /* Glow effect removed for desktop */
  }
}

/* Large Desktop (1280px+) */
@media (min-width: 1280px) {
  .header-logo {
    width: 180px;
    height: 80px;
    top: 1.25rem;
    left: 1.25rem;
  }
  
  .chat-bubble {
    max-width: 75%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }
  
  .answer-button {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    min-height: 52px;
  }
  
  .avatar {
    width: 2.5rem;
    height: 2.5rem;
    margin-right: 1rem;
  }
  
  .progress-bar {
    height: 1rem;
  }
  
  .terminal-glow {
    /* Glow effect removed for large desktop */
  }
  
  .max-w-4xl {
    max-width: 80rem;
  }
  
  .max-w-2xl {
    max-width: 60rem;
  }
}

/* Ultra Wide (1920px+) */
@media (min-width: 1920px) {
  .header-logo {
    width: 200px;
    height: 90px;
    top: 1.5rem;
    left: 1.5rem;
  }
  
  .chat-bubble {
    max-width: 70%;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
  }
  
  .answer-button {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    min-height: 56px;
  }
  
  .avatar {
    width: 3rem;
    height: 3rem;
    margin-right: 1.25rem;
  }
  
  .terminal-glow {
    /* Glow effect removed for ultra wide */
  }
}

/* Touch-friendly buttons for mobile */
@media (max-width: 639px) {
  .answer-button {
    min-height: 48px;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
  }
  
  .answer-button:active {
    transform: scale(0.95);
  }
  
  /* Mobile scrollbar styling */
  #chat-container::-webkit-scrollbar {
    width: 4px;
  }
  
  #chat-container::-webkit-scrollbar-track {
    background: var(--card);
  }
  
  #chat-container::-webkit-scrollbar-thumb {
    background: var(--terminal-green);
    border-radius: 2px;
  }
  
  #chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--terminal-blue);
  }
  
  /* Mobile answer section scrollbar */
  .sticky.bottom-0::-webkit-scrollbar {
    width: 4px;
  }
  
  .sticky.bottom-0::-webkit-scrollbar-track {
    background: var(--card);
  }
  
  .sticky.bottom-0::-webkit-scrollbar-thumb {
    background: var(--terminal-green);
    border-radius: 2px;
  }
}

/* Landscape mobile optimization */
@media (max-width: 639px) and (orientation: landscape) {
  .header-logo {
    width: 80px;
    height: 30px;
    top: 0.25rem;
    left: 0.25rem;
  }
  
  .chat-bubble {
    max-width: 90%;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    max-height: 50vh;
  }
  
  .answer-button {
    min-height: 36px;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
  
  .avatar {
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.4rem;
  }
  
  /* Landscape chat container */
  #chat-container {
    min-height: calc(100vh - 120px);
  }
}

/* Terminal Glow Effect */
.terminal-glow {
  /* Glow effect removed */
}

.terminal-border {
  border: 1px solid var(--terminal-green);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

/* Progress Bar Terminal Style */
.progress-bar {
  transition: width 500ms ease-out;
  background: linear-gradient(90deg, var(--terminal-green), var(--terminal-blue));
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

/* Loading Spinner */
.loading-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid transparent;
  border-bottom-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Chat Message Styling - Terminal Style */
.chat-message {
  margin-bottom: 1rem;
  padding-left: 0;
  text-align: left;
}

.chat-message.user {
  padding-left: 0;
}

.chat-message.assistant {
  padding-left: 0;
}

.chat-bubble {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 2px 4px var(--shadow);
  max-width: 100%;
  text-align: left;
  font-family: 'Courier New', monospace;
}

.chat-bubble p {
  text-align: left;
  margin: 0;
  padding: 0;
}

.chat-bubble.assistant {
  border-left: 3px solid var(--terminal-green);
}

.chat-bubble.user {
  background-color: var(--terminal-blue);
  color: white;
  margin-left: auto;
  border-right: 3px solid var(--terminal-green);
}

.avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.25rem;
  background: var(--card);
  border: 1px solid var(--terminal-green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--terminal-green);
  font-weight: bold;
  font-size: 0.875rem;
  flex-shrink: 0;
  margin-right: 0.75rem;
  font-family: 'Courier New', monospace;
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 0.25rem;
  object-fit: cover;
}

/* Answer Button Styling */
.answer-button {
  padding: 0.625rem 1rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  transition: all 200ms;
  border: 1px solid var(--border);
  background-color: var(--card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 44px;
  font-family: 'Courier New', monospace;
  width: 100%;
  justify-content: flex-start;
}

.answer-button:hover {
  border-color: var(--terminal-green);
  background-color: rgba(0, 255, 0, 0.1);
  color: var(--terminal-green);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.answer-button:active {
  transform: scale(0.98);
}

.chevron-icon {
  width: 0.75rem;
  height: 0.75rem;
  opacity: 0;
  transition: opacity 200ms;
}

.answer-button:hover .chevron-icon {
  opacity: 1;
}

@media (min-width: 640px) {
  .answer-button {
    padding: 0.5rem 0.75rem;
    min-height: 0;
    width: auto;
  }
  
  .chevron-icon {
    opacity: 0;
  }
}

/* Modal Styles */
.modal-backdrop {
  backdrop-filter: blur(4px);
}

.modal-content {
  backdrop-filter: blur(8px);
  background-color: rgba(26, 31, 46, 0.95);
}

/* Terminal Colors */
.bg-terminal-green\/20 { background-color: rgba(0, 255, 0, 0.2); }
.text-terminal-green { color: var(--terminal-green); }
.border-terminal-green { border-color: var(--terminal-green); }
.bg-terminal-green\/10 { background-color: rgba(0, 255, 0, 0.1); }
.hover\:bg-terminal-green:hover { background-color: var(--terminal-green); }
.hover\:text-white:hover { color: white; }
.hover\:shadow-glow:hover { box-shadow: 0 0 10px rgba(0, 255, 0, 0.4); }

/* Modal Animations */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-show {
  animation: modalFadeIn 0.3s ease-out;
}
