/* ============================================
   Campfire V2 — Common Styles
   Dark theme, shared across all pages.
   ============================================ */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1e1e1e;
  --bg-card: #161616;
  --bg-input: #222;
  --bg-hover: #2a2a2a;
  --border: #333;
  --border-light: #444;
  --text-primary: #e0e0e0;
  --text-secondary: #999;
  --text-muted: #666;
  --accent: #ff6b35;
  --accent-hover: #ff8555;
  --accent-glow: rgba(255, 107, 53, 0.3);
  --success: #43e97b;
  --warning: #fee140;
  --danger: #f5576c;
  --info: #4facfe;
  --purple: #9b59b6;
  --blue: #3498db;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
  --font-mono: 'Consolas', 'Courier New', monospace;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all var(--transition);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 16px var(--accent-glow); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-success { background: var(--success); color: #000; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Inputs ---- */
input, select, textarea {
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font-size: 14px; width: 100%;
  transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow);
}

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ---- Navigation / Header ---- */
.page-header {
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  padding: 12px 20px; display: flex; align-items: center; justify-content: space-between;
}
.page-header .logo { font-size: 18px; font-weight: 700; color: var(--accent); }
.page-header nav { display: flex; gap: 16px; align-items: center; }
.page-header nav a { color: var(--text-secondary); font-size: 14px; }
.page-header nav a:hover { color: var(--text-primary); }

/* ---- Status indicators ---- */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.status-dot.lit { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.embers { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.status-dot.out { background: var(--text-muted); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab {
  padding: 8px 16px; border: none; background: none; color: var(--text-secondary);
  cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ---- Toast / Notifications ---- */
.toast {
  position: fixed; bottom: 20px; right: 20px; padding: 12px 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  z-index: 10000; animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- Loading ---- */
.spinner {
  width: 24px; height: 24px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Connection Badge (vertical lines indicator) ---- */
.conn-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  background: rgba(28,28,28,0.95); border: 1px solid rgba(255,255,255,0.12);
  font-size: 10px; color: var(--text-muted); white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.conn-lines {
  display: flex; flex-direction: row; gap: 2px; align-items: center;
}
.conn-line {
  width: 2px; height: 12px; border-radius: 1px;
  background: #ff3b30;
  transition: background 0.3s;
}
.conn-line.on { background: #34c759; box-shadow: 0 0 4px rgba(52,199,89,0.5); }
.conn-line.connecting { background: #ffcc00; box-shadow: 0 0 4px rgba(255,204,0,0.4); }
.conn-badge-label { font-weight: 600; letter-spacing: 0.3px; }
.conn-badge.all-on { border-color: rgba(52,199,89,0.3); }
.conn-badge.all-on .conn-badge-label { color: #34c759; }
.conn-badge.partial .conn-badge-label { color: #ffcc00; }
.conn-badge.all-off .conn-badge-label { color: #ff3b30; }

/* Placement — top right aligned with layout, centered on menu bar */
.conn-badge-wrap {
  position: absolute; top: 0; right: 0; z-index: 1001;
}

/* ---- Site Footer ---- */
.site-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 12px; text-align: center; font-size: 11px;
  color: var(--accent); background: transparent; opacity: 0.5;
  z-index: 10; pointer-events: none;
}
.site-footer a { color: var(--accent); pointer-events: auto; }
.site-footer a:hover { color: var(--accent-hover); opacity: 1; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 8px; }
}
