:root {
  --bg-dark: #0f1115;
  --bg-card: #16181d;
  --bg-input: #1f2229;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --red-bear: #ef4444;
  --red-bear-bg: rgba(239, 68, 68, 0.1);
  --green-bull: #10b981;
  --border-light: rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 4px 30px rgba(59, 130, 246, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 1300px; /* Increased for sidebar */
  padding: 2rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 5rem; /* Increased significantly */
  align-items: flex-start;
  width: 100%;
}

.main-content {
  width: 100%;
  max-width: 900px;
}

/* History Sidebar */
.history-sidebar {
  background: rgba(22, 24, 29, 0.5);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 1.5rem;
  height: calc(100vh - 200px);
  position: sticky;
  top: 2rem;
  display: flex;
  flex-direction: column;
}

.history-sidebar h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  margin-bottom: 1.5rem;
}

.history-list {
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.history-item {
  padding: 1rem;
  background: var(--bg-input);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.history-item:hover {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
  transform: translateX(4px);
}

.history-item .ticker {
  font-weight: 800;
  color: var(--text-main);
  display: block;
}

.history-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item .ticker {
  font-weight: 800;
  color: var(--text-main);
}

.free-badge-pill {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--green-bull);
  background: rgba(16, 185, 129, 0.1);
  padding: 1px 4px;
  border-radius: 4px;
  text-transform: uppercase;
}

.history-item .date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-top: 2rem;
}

/* Activity Feed (Loading State) */
.loading-wrapper {
  display: flex;
  gap: 2.5rem;
  background: var(--bg-card);
  padding: 2.5rem;
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

.spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-content {
  flex-grow: 1;
}

#dynamic-status-text {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.activity-feed {
  height: 120px;
  overflow-y: hidden;
  display: flex;
  flex-direction: column-reverse;
  font-family: 'IBM Plex Mono', monospace; /* Scientific feel */
  font-size: 0.85rem;
  color: var(--text-muted);
}

.activity-line {
  margin-bottom: 0.4rem;
  animation: fadeIn 0.3s ease-out;
}

.activity-line::before {
  content: ">";
  color: var(--accent-blue);
  margin-right: 0.75rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 3rem;
}

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

.logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--accent-blue);
}

#credit-badge {
  background-color: var(--bg-card);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  font-size: 0.9rem;
  color: var(--text-muted);
}

#credits-count {
  color: var(--text-main);
}

.search-section {
  text-align: center;
  margin-bottom: 4rem;
}

.search-section h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-section p {
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.search-box {
  display: flex;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

#ticker-input {
  flex: 1;
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  color: var(--text-main);
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#ticker-input:focus {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow);
}

#submit-btn {
  background-color: var(--accent-blue);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
}

#submit-btn:hover {
  background-color: var(--accent-blue-hover);
}

#submit-btn:active {
  transform: scale(0.98);
}

/* Loading States */
.state-container {
  animation: fadeIn 0.4s ease-out forwards;
}

.agent-loaders {
  display: flex;
  justify-content: space-around;
  margin-bottom: 3rem;
}

.agent-loader, .synthesizer-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner.glow {
  border-top-color: var(--red-bear);
  box-shadow: 0 0 15px var(--red-bear-bg);
}

/* Results Display */
/* Results Display Refinement */
.result-header {
  margin-bottom: 3.5rem;
}

.ticker-title {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
}

.grades-row {
  display: flex;
  gap: 2.5rem;
  margin-left: 0.2rem;
}

.grade-item {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 700;
}

.grade-item span {
  color: #fff;
  margin-left: 0.75rem;
  font-weight: 900;
  font-size: 0.85rem;
}

.metrics-bar {
  display: flex;
  justify-content: space-between;
  background: rgba(31, 34, 41, 0.5);
  padding: 2.5rem;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  margin-bottom: 3rem;
  backdrop-filter: blur(10px);
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-start;
}

.metric-item span {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.metric-item strong {
  font-size: 1.6rem;
  color: var(--accent-blue);
  font-weight: 900;
  letter-spacing: -0.5px;
}

/* Vertical Analysis Stack */
.analysis-stack {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 3rem;
}

.analysis-card {
  background-color: var(--bg-card);
  padding: 2.5rem;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  line-height: 1.8;
  position: relative;
}

.analysis-card h3 {
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
}

.thesis-card {
  border-left: 4px solid var(--accent-blue);
}

.bear-card {
  border-left: 4px solid var(--red-bear);
  background: linear-gradient(to right, rgba(239, 68, 68, 0.03), transparent);
}

.analysis-text {
  font-size: 1.05rem;
  color: var(--text-main);
}

.bottom-line-wrapper {
  margin-top: 2.5rem;
}

.summary-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin-bottom: 2.5rem;
  opacity: 0.6;
}

.bottom-line-label {
  display: block;
  color: var(--red-bear);
  font-weight: 900;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
}

.catalyst-list {
  list-style: none;
}

.catalyst-list li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 1.2rem;
  color: var(--text-main);
  font-size: 1.05rem;
}

.catalyst-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent-blue);
  font-weight: 900;
}

.disclaimer-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Public pSEO Page Styles */
.public-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.public-badge {
  background-color: var(--accent-blue-hover);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.public-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-box {
  background-color: var(--bg-card);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  text-align: center;
}

.stat-box label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-box strong {
  font-size: 1.5rem;
  color: var(--text-main);
}

.public-description {
  margin-bottom: 4rem;
  line-height: 1.7;
}

.public-description h3 {
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.conversion-hook {
  position: relative;
  background-color: #12141a;
  border: 1px dashed var(--border-light);
  border-radius: 16px;
  padding: 3rem;
  text-align: center;
  overflow: hidden;
}

.hook-content {
  position: relative;
  z-index: 2;
}

.hook-content h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.hook-content p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.blurred-preview {
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  padding: 2rem;
  filter: blur(8px);
  opacity: 0.3;
  pointer-events: none;
}

.blurred-line {
  height: 12px;
  background-color: var(--text-muted);
  margin-bottom: 10px;
  border-radius: 4px;
}

/* Terminal UI */
.terminal-window {
  background-color: #000;
  border-radius: 8px;
  border: 1px solid #333;
  overflow: hidden;
  font-family: 'Courier New', Courier, monospace;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  margin-bottom: 2rem;
}

.terminal-header {
  background-color: #1a1b20;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #333;
}

.terminal-dots {
  display: flex;
  gap: 6px;
  margin-right: 15px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red { background-color: #ff5f56; }
.dot.yellow { background-color: #ffbd2e; }
.dot.green { background-color: #27c93f; }

.terminal-title {
  color: #888;
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.terminal-body {
  padding: 1.5rem;
  min-height: 180px;
  max-height: 300px;
  overflow-y: auto;
  color: #4ade80;
  font-size: 0.95rem;
  line-height: 1.6;
}

.terminal-msg {
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeInTerminal 0.3s forwards;
}

.terminal-msg::before {
  content: "> ";
  color: #888;
}

.terminal-loader {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem 1.5rem;
  background-color: #0a0a0c;
  border-top: 1px solid #222;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
}

@keyframes fadeInTerminal {
  from { opacity: 0; transform: translateX(-5px); }
  to { opacity: 1; transform: translateX(0); }
}

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

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

/* Tooltips */
.label-with-tooltip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tooltip-icon {
  font-size: 0.65rem;
  color: var(--text-muted);
  cursor: help;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-light);
  border-radius: 50%;
}

.tooltip-text {
  visibility: hidden;
  width: 220px;
  background-color: #1a1c23;
  color: #fff;
  text-align: left;
  border-radius: 8px;
  padding: 0.8rem;
  position: absolute;
  z-index: 100;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.75rem;
  text-transform: none;
  font-weight: 400;
  border: 1px solid var(--border-light);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  line-height: 1.4;
  pointer-events: none;
}

.tooltip-icon:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Sidebar Refinements */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.free-badge {
  font-size: 0.6rem;
  background: rgba(16, 185, 129, 0.1);
  color: var(--green-bull);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  text-transform: uppercase;
  font-weight: 800;
}

/* Action Buttons */
.report-actions {
  display: flex;
  justify-content: center;
  margin-top: 3rem;
  padding-bottom: 2rem;
}

.secondary-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 0.8rem 1.8rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.secondary-btn:hover {
  background: var(--bg-input);
  color: #fff;
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

/* Mobile Responsiveness Improvements */
@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .history-sidebar {
    height: auto;
    position: relative;
    top: 0;
    order: 2; /* Move history below main search on mobile */
  }

  .main-content {
    order: 1;
  }

  .metrics-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }
  
  .ticker-title {
    font-size: 2.5rem;
  }

  .grades-row {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .metrics-bar {
    grid-template-columns: 1fr;
  }

  .app-container {
    padding: 1rem;
  }
}

