/* ==========================================================================
   Render.com Inspired Minimalist Design System
   Font: Inter + JetBrains Mono
   Theme: Obsidian / Deep Dark with Hairline Borders & Emerald/Crimson Accents
   ========================================================================== */

:root {
  --bg-canvas: #07080b;
  --bg-card: #0d1117;
  --bg-card-subtle: #131720;
  --bg-input: #0a0d14;
  
  --border-hairline: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 0, 51, 0.5);
  
  --text-main: #f1f5f9;
  --text-muted: #8b949e;
  --text-subtle: #4b5563;
  
  --accent-crimson: #ff0033;
  --accent-crimson-hover: #e6002e;
  --accent-emerald: #10b981;
  --accent-emerald-subtle: rgba(16, 185, 129, 0.12);
  --accent-amber: #f59e0b;
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 9999px;
  
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-canvas);
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.render-app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ==========================================================================
   Header (Ultra Minimal, Render.com Style)
   ========================================================================== */

.render-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-hairline);
  flex-wrap: wrap;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: #ff0033;
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(255, 0, 51, 0.35);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.badge-subtle {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-subtle);
  transition: all 0.3s var(--ease);
}

.pill-dot.emerald {
  background: var(--accent-emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   Buttons (Render.com High Contrast & Clean Dark)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  text-decoration: none;
  line-height: 1;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Primary Button (Render Style Crisp Solid) */
.btn-primary {
  background: #ffffff;
  color: #000000;
  padding: 10px 18px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn-primary .btn-play-icon {
  fill: #000000;
}

/* Secondary Button */
.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border: 1px solid var(--border-hairline);
  padding: 8px 14px;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.78rem;
}

/* YouTube Login Button */
.btn-login {
  background: rgba(255, 0, 51, 0.1);
  color: #ff4d6d;
  border: 1px solid rgba(255, 0, 51, 0.25);
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-login:hover:not(:disabled) {
  background: rgba(255, 0, 51, 0.18);
  border-color: rgba(255, 0, 51, 0.4);
}

.btn-login.logged-in {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

/* Spinner */
.btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ==========================================================================
   Cards & Layout
   ========================================================================== */

.render-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-hairline);
  flex-wrap: wrap;
  gap: 12px;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.badge-count {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-emerald);
  background: var(--accent-emerald-subtle);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Input Textarea & Controls
   ========================================================================== */

.textarea-container {
  padding: 14px 18px;
  background: var(--bg-input);
}

.code-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.code-textarea::placeholder {
  color: #3b4252;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.015);
  border-top: 1px solid var(--border-hairline);
  flex-wrap: wrap;
  gap: 14px;
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  padding: 4px 8px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
}

.control-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.render-select {
  background: transparent;
  color: var(--text-main);
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
}

.render-select option {
  background: #11151c;
  color: #ffffff;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.progress-section {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.progress-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.pulsing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px var(--accent-emerald); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.progress-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-main);
}

.progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff0033, #f59e0b, #10b981);
  transition: width 0.3s ease;
}

/* ==========================================================================
   Metrics Grid (4 Clean Cards)
   ========================================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

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

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s var(--ease);
}

.metric-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.metric-card.highlight-emerald {
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.03);
}

.metric-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}

.metric-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.text-emerald { color: #34d399; }
.text-teal { color: #38bdf8; }

/* ==========================================================================
   Results Table & Filters
   ========================================================================== */

.filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
}

.filter-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.filter-pill.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-weight: 500;
}

.table-wrapper {
  overflow-x: auto;
}

.render-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.render-table th {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-hairline);
}

.render-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.render-table tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.text-right {
  text-align: right;
}

/* Links & Pill Badges in Table */
.channel-link {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
}

.channel-link:hover {
  text-decoration: underline;
  color: #38bdf8;
}

.email-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hairline);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #f8fafc;
}

.copy-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color 0.15s;
}

.copy-icon-btn:hover {
  color: var(--text-main);
}

/* Badges */
.badge-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 500;
}

.tag-t1 {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #22d3ee;
}

.tag-t2 {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.tag-t3 {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.tag-unresolved {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hairline);
  color: var(--text-subtle);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.success { color: #34d399; }
.status-badge.failed { color: #f87171; }
.status-badge.none { color: var(--text-subtle); }

/* Table Action Buttons */
.action-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.btn-manual {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 0.75rem;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s;
}

.btn-manual:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
}

.enter-email-btn {
  padding: 4px 8px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hairline);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.enter-email-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Empty State */
.empty-state-box {
  padding: 48px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.empty-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  margin-bottom: 4px;
}

.empty-state-box h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.empty-state-box p {
  font-size: 0.82rem;
}

/* ==========================================================================
   Render Style Toast
   ========================================================================== */

.render-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #181c24;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.2s var(--ease);
  z-index: 9999;
}

.render-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.render-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-hairline);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.render-footer span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-hairline);
}

