/* ============================================================================
   Claude's Minecraft Adventures - Stylesheet
   Dark terminal aesthetic with Minecraft vibes
   ============================================================================ */

:root {
  /* Colors - Dark earthy Minecraft palette */
  --bg-primary: #1a1a1a;
  --bg-secondary: #242424;
  --bg-tertiary: #2d2d2d;
  --bg-card: #1e1e1e;
  
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  
  --accent-green: #4ade80;
  --accent-blue: #60a5fa;
  --accent-orange: #fb923c;
  --accent-purple: #c084fc;
  --accent-red: #f87171;
  
  --border-color: #333333;
  --border-subtle: #2a2a2a;
  
  /* Typography */
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: 'Space Grotesk', -apple-system, sans-serif;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* Misc */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow: hidden;
}

/* Layout */
.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 800px;
  margin: 0 auto;
}

/* Header */
.header {
  flex-shrink: 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.title-icon {
  font-size: 1.5rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.how-it-works-link {
  font-size: 0.875rem;
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

.how-it-works-link:hover {
  color: var(--accent-purple);
  text-decoration: underline;
}

.status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s ease;
}

.status-dot.live {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.paused {
  background: var(--accent-orange);
}

.status-dot.error {
  background: var(--accent-red);
}

.status-dot.offline {
  background: var(--accent-red);
  opacity: 0.7;
}

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

/* Feed */
.feed {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

.sentinel {
  height: 1px;
  flex-shrink: 0;
}

#events-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Loading indicator */
.loading-history {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.loading-history.visible {
  display: flex;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Event Cards */
.event {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  animation: slideIn 0.3s ease-out;
}

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

.event-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.event-type {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
}

.event-type.comment {
  background: rgba(96, 165, 250, 0.15);
  color: var(--accent-blue);
}

.event-type.screenshot {
  background: rgba(192, 132, 252, 0.15);
  color: var(--accent-purple);
}

.event-type.action,
.event-type.tool_use {
  background: rgba(251, 146, 60, 0.15);
  color: var(--accent-orange);
}

.event-type.tool_result {
  background: rgba(74, 222, 128, 0.15);
  color: var(--accent-green);
}

.event-time {
  margin-left: auto;
}

.event-content {
  color: var(--text-primary);
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Screenshot */
.event-screenshot {
  margin-top: var(--space-sm);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-tertiary);
}

.event-screenshot img {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.event-screenshot img:hover {
  transform: scale(1.02);
}

/* Tool use styling - collapsible */
.event-tool-details {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-orange);
}

.event-tool-summary {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.event-tool-summary::-webkit-details-marker {
  display: none;
}

.event-tool-summary::before {
  content: '▶';
  font-size: 0.6rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.event-tool-details[open] .event-tool-summary::before {
  transform: rotate(90deg);
}

.event-tool-icon {
  font-size: 0.9rem;
}

.event-tool-name {
  color: var(--accent-orange);
  font-weight: 600;
}

.event-tool-has-params {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.event-tool-params {
  padding: var(--space-sm) var(--space-md);
  padding-top: 0;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.event-tool-params pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Tool group - multiple consecutive tools */
.event-tool-group .event-tool-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.event-tool-group .event-tool-details {
  border-radius: var(--radius-sm);
}

.event-tool-group .event-tool-details:first-child {
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

.event-tool-group .event-tool-details:last-child {
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

/* Scroll to bottom button */
.scroll-btn {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
  transition: all 0.2s ease;
  z-index: 50;
}

.scroll-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.scroll-btn:hover {
  background: var(--accent-purple);
  transform: scale(1.1);
}

.new-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--accent-red);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 10px;
  display: none;
  align-items: center;
  justify-content: center;
}

.new-count.visible {
  display: flex;
}

/* Footer */
.footer {
  flex-shrink: 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.separator {
  opacity: 0.5;
}

/* Image lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  cursor: zoom-out;
}

.lightbox.visible {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border-radius: var(--radius-md);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--text-secondary);
  text-align: center;
  gap: var(--space-md);
}

.empty-state-icon {
  font-size: 3rem;
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    max-width: 100%;
  }
  
  .header {
    padding: var(--space-sm) var(--space-md);
  }
  
  .title {
    font-size: 1rem;
  }
  
  .feed {
    padding: var(--space-sm);
  }
  
  .event {
    padding: var(--space-sm);
  }
  
  .scroll-btn {
    right: 16px;
    bottom: 70px;
  }
}

/* Scrollbar */
.feed::-webkit-scrollbar {
  width: 8px;
}

.feed::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.feed::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.feed::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

