/* Satori Demo Styles - Ruby Theme */

:root {
  /* Ruby theme colors - Light mode */
  --color-primary: #b30000;
  --color-primary-light: #d32f2f;
  --color-secondary: #7b1fa2;
  --color-accent: #9c27b0;
  
  --gradient-primary: linear-gradient(135deg, #b30000 0%, #7b1fa2 100%);
  --gradient-light: linear-gradient(135deg, rgba(179, 0, 0, 0.1) 0%, rgba(123, 31, 162, 0.1) 100%);
  
  --color-bg: #faf8f5;
  --color-bg-alt: #ffffff;
  --color-surface: #ffffff;
  --color-border: #e8e4df;
  
  --color-text: #2d2926;
  --color-text-secondary: #5c5652;
  --color-text-muted: #8a847e;
  
  /* Level colors */
  --color-debug: #6b7280;
  --color-info: #2563eb;
  --color-warn: #d97706;
  --color-error: #dc2626;
  --color-critical: #7c2d12;
  
  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  
  /* Borders */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

[data-theme="dark"] {
  --color-primary: #ff5252;
  --color-primary-light: #ff8a80;
  --color-secondary: #ce93d8;
  --color-accent: #e1bee7;
  
  --gradient-primary: linear-gradient(135deg, #ff5252 0%, #ce93d8 100%);
  --gradient-light: linear-gradient(135deg, rgba(255, 82, 82, 0.15) 0%, rgba(206, 147, 216, 0.15) 100%);
  
  --color-bg: #1a1a1a;
  --color-bg-alt: #0d0d0d;
  --color-surface: #242424;
  --color-border: #3d3d3d;
  
  --color-text: #f5f5f5;
  --color-text-secondary: #b0b0b0;
  --color-text-muted: #757575;
  
  --color-debug: #9ca3af;
  --color-info: #60a5fa;
  --color-warn: #fbbf24;
  --color-error: #f87171;
  --color-critical: #fca5a5;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

/* Header */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo img {
  height: 36px;
  width: auto;
}

.logo-light { display: block; }
.logo-dark { display: none; }

[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

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

.nav-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--color-primary);
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--gradient-light);
  color: var(--color-primary);
}

.sun-icon { display: block; }
.moon-icon { display: none; }

[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }

/* Main Layout */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-xl);
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--space-xl);
  width: 100%;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Content */
.content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
}

/* Panels */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.panel-title {
  font-size: 1.125rem;
  color: var(--color-text);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid transparent;
  border-image: var(--gradient-primary) 1;
}

.panel-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-md);
}

/* Form Elements */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

input[type="text"],
select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(179, 0, 0, 0.1);
}

[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] select:focus {
  box-shadow: 0 0 0 3px rgba(255, 82, 82, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-small {
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.75rem;
}

.btn-block {
  width: 100%;
}

.button-group {
  display: flex;
  gap: var(--space-sm);
}

.feature-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Counter */
.counter-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--gradient-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.counter-label {
  font-weight: 600;
  color: var(--color-text-secondary);
}

.counter-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Watch Status */
.watch-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.status-dot.stopped {
  background: var(--color-text-muted);
}

.watch-status span:last-of-type {
  flex: 1;
  color: var(--color-text-secondary);
}

/* Metrics */
.metrics-panel {
  flex-shrink: 0;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-md);
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md);
  background: var(--gradient-light);
  border-radius: var(--radius-md);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: var(--space-xs);
}

/* Events Panel */
.events-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.events-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.events-header .panel-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.event-count {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

.filter-select,
.filter-input {
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.875rem;
  width: auto;
}

.filter-input {
  width: 150px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.checkbox-label input {
  accent-color: var(--color-primary);
}

/* Event List */
.event-list {
  flex: 1;
  overflow-y: auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  max-height: clamp(240px, 40vh, 520px);
  min-height: 240px;
}

.event-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--color-text-muted);
  font-style: italic;
}

.event-item {
  display: grid;
  grid-template-columns: 100px 70px 1fr auto;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  transition: background var(--transition-fast);
  border-left: 3px solid transparent;
}

.event-item:hover {
  background: var(--color-surface);
}

.event-item.level-debug { border-left-color: var(--color-debug); }
.event-item.level-info { border-left-color: var(--color-info); }
.event-item.level-warn { border-left-color: var(--color-warn); }
.event-item.level-error { border-left-color: var(--color-error); }
.event-item.level-critical { border-left-color: var(--color-critical); }

.event-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.event-level {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.event-level.debug { color: var(--color-debug); }
.event-level.info { color: var(--color-info); }
.event-level.warn { color: var(--color-warn); }
.event-level.error { color: var(--color-error); }
.event-level.critical { color: var(--color-critical); }

.event-message {
  color: var(--color-text);
  word-break: break-word;
}

.event-scope {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-align: right;
}

.event-json {
  grid-column: 1 / -1;
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
}

/* Footer */
.footer {
  text-align: center;
  padding: var(--space-lg);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--color-border);
}

.footer a {
  color: var(--color-primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .main {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .sidebar .panel {
    flex: 1;
    min-width: 280px;
  }
}

@media (max-width: 600px) {
  .header-content {
    padding: var(--space-md);
  }
  
  .main {
    padding: var(--space-md);
  }
  
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .event-item {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
  }
  
  .event-scope {
    text-align: left;
  }
  
  .filter-bar {
    width: 100%;
  }
  
  .filter-input {
    flex: 1;
  }
}
