/* esp32/watchy.css */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { background: #0a0a0a; color: #e2e8f0; font-family: system-ui, sans-serif; min-height: 100vh; }

/* ── Nav ──────────────────────────────────────────────────────────── */
nav {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-bottom: 1px solid #111;
  font-size: 0.82rem; color: #555; position: sticky; top: 0;
  background: rgba(10,10,10,0.92); backdrop-filter: blur(8px); z-index: 100;
}
nav a { color: #555; text-decoration: none; }
nav a:hover { color: #aaa; }
nav .spacer { flex: 1; }
#nav-auth { position: relative; }
#nav-auth-btn {
  background: none; border: 1px solid #252525; border-radius: 6px;
  color: #444; font-size: 0.75rem; padding: 4px 10px; cursor: pointer;
  font-family: inherit; transition: color 0.2s, border-color 0.2s;
  text-decoration: none; display: inline-block; line-height: 1.6;
}
#nav-auth-btn:hover { color: #888; border-color: #333; }
#nav-auth-btn.authed { color: #4ade80; border-color: rgba(74,222,128,0.25); }
#nav-auth-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: #0e0e0e; border: 1px solid #1e1e1e; border-radius: 8px;
  min-width: 160px; z-index: 200; overflow: hidden;
}
#nav-auth-dropdown.open { display: block; }
.nav-dd-item {
  display: block; padding: 9px 14px; font-size: 0.8rem; color: #888;
  text-decoration: none; cursor: pointer; background: none; border: none;
  font-family: inherit; width: 100%; text-align: left; transition: background .15s, color .15s;
}
.nav-dd-item:hover { background: #161616; color: #ccc; }
.nav-dd-item.danger:hover { color: #f87171; }

main { padding: 32px 24px; max-width: 1200px; margin: 0 auto; }
h1   { font-size: 1.4rem; font-weight: 600; margin-bottom: 4px; }
.subtitle { color: #64748b; font-size: 0.85rem; margin-bottom: 28px; }

/* ── Tab bar ─────────────────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 4px; margin-bottom: 24px; flex-wrap: wrap;
  border-bottom: 1px solid #1e2230;
}
.tab-btn {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: #64748b; font-size: 0.85rem; font-family: inherit;
  padding: 8px 16px; cursor: pointer; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: #94a3b8; }
.tab-btn.active { color: #e2e8f0; border-bottom-color: #f59e0b; }

/* ── Info grid ──────────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 20px;
}
.info-section {
  background: #141720; border: 1px solid #1e2230; border-radius: 10px; padding: 20px;
  min-width: 0; overflow: hidden;
}
.info-section--wide { grid-column: 1 / -1; }
.info-section h2 {
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: #94a3b8; margin-bottom: 14px;
}
.info-sub-h {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: #64748b; margin: 14px 0 8px;
}

/* ── Info tables ─────────────────────────────────────────────────── */
.info-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; table-layout: fixed; }
.info-table th {
  text-align: left; padding: 6px 10px 6px 0;
  color: #64748b; font-weight: 500; border-bottom: 1px solid #1e2230;
  overflow-wrap: break-word;
}
.info-table td {
  padding: 6px 10px 6px 0; border-bottom: 1px solid #0f1117; vertical-align: top;
  overflow-wrap: break-word; word-break: break-word;
}
.info-table tr:last-child td { border-bottom: none; }
.info-key { color: #64748b; white-space: nowrap; padding-right: 16px; width: 36%; }
.info-table code { font-family: monospace; font-size: 0.78rem; color: #a5b4fc; word-break: break-all; }

/* ── Prose / notes ───────────────────────────────────────────────── */
.info-prose { font-size: 0.82rem; color: #94a3b8; line-height: 1.6; margin-bottom: 10px; }
.info-note  { font-size: 0.75rem; color: #64748b; margin-top: 10px; line-height: 1.5; }
.info-note.critical { color: #f87171; }

/* ── Code block ──────────────────────────────────────────────────── */
.info-code {
  background: #0d1015; border: 1px solid #1e2230; border-radius: 6px;
  padding: 12px 14px; font-size: 0.78rem; color: #94a3b8;
  font-family: monospace; white-space: pre; overflow-x: auto; margin-top: 10px;
  display: block; max-width: 100%;
}

/* ── Flow steps ──────────────────────────────────────────────────── */
.flow-row {
  display: flex; gap: 0; align-items: flex-start; flex-wrap: wrap;
}
.flow-step {
  display: flex; gap: 12px; flex: 1; min-width: 200px;
  background: #0d1015; border: 1px solid #1e2230; border-radius: 8px;
  padding: 14px; margin: 4px;
}
.flow-step-num {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: #1e2230; border: 1px solid rgba(245,158,11,.3);
  color: #f59e0b; font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.flow-step-body { flex: 1; min-width: 0; overflow-wrap: break-word; }
.flow-step-title { font-size: 0.82rem; font-weight: 600; color: #e2e8f0; margin-bottom: 5px; }
.flow-step-desc  { font-size: 0.75rem; color: #64748b; line-height: 1.55; }
.flow-step-desc code { font-family: monospace; font-size: 0.72rem; color: #a5b4fc; }
.flow-connector {
  font-size: 1.1rem; color: #334155; padding: 18px 2px 0; flex-shrink: 0;
}
@media (max-width: 800px) { .flow-connector { display: none; } }

/* ── Links inside sections ───────────────────────────────────────── */
.info-section a { color: #60a5fa; text-decoration: none; }
.info-section a:hover { text-decoration: underline; }

/* ── Status / version badges ─────────────────────────────────────── */
.good { color: #34d399; }
.warn { color: #fbbf24; }
.bad  { color: #f87171; }

.badge-tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 0.65rem; font-weight: 600; background: #1e293b; color: #94a3b8; white-space: nowrap; }
.badge-tag.good    { background: #14532d; color: #4ade80; }
.badge-tag.bad     { background: #450a0a; color: #f87171; }
.badge-tag.warn    { background: #422006; color: #fbbf24; }
.badge-tag.current { background: #1a2443; color: #93c5fd; }
.badge-tag.planned { background: #2e1a4a; color: #c084fc; }
.badge-tag.parked  { background: #1a1a1a; color: #6b7280; }

/* Nested grid inside a wide info-section (Research Findings) */
.research-subgrid { padding: 0; border: none; background: none; margin-top: 4px; }

/* ── Firmware comparison table ───────────────────────────────────── */
.fw-compare-wrap {
  overflow-x: auto; border-radius: 10px; border: 1px solid #1e2230;
  background: #0d1015;
}
.fw-compare-table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem; min-width: 800px;
}
.fw-compare-table th {
  text-align: left; padding: 10px 14px;
  background: #141720; color: #64748b; font-weight: 500;
  border-bottom: 1px solid #1e2230; white-space: nowrap;
}
.fw-compare-table td {
  padding: 9px 14px; border-bottom: 1px solid #0f1117; vertical-align: top;
}
.fw-compare-table tbody tr:hover td { background: #141720; }
.fw-compare-table tbody tr:last-child td { border-bottom: none; }
.fw-compare-table tbody tr.fw-current td { background: #141a10; }
.fw-name { font-weight: 600; color: #e2e8f0; }
.fw-name a { color: #60a5fa; text-decoration: none; }
.fw-name a:hover { text-decoration: underline; }
.fw-base { color: #475569; font-size: 0.72rem; margin-top: 2px; }
.fw-features { color: #94a3b8; font-size: 0.75rem; line-height: 1.5; }

/* Capability pill badges */
.cap { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 0.68rem; font-weight: 600; white-space: nowrap; }
.cap-ota-http    { background: #14532d; color: #4ade80; }
.cap-ota-browser { background: #1a2e4a; color: #60a5fa; }
.cap-ota-manual  { background: #1e293b; color: #64748b; }
.cap-ble-full    { background: #2e1a4a; color: #c084fc; }
.cap-ble-wifi    { background: #1a2443; color: #7dd3fc; }
.cap-ble-kbd     { background: #1e2a3a; color: #94a3b8; }
.cap-ble-none    { background: #111; color: #374151; }
.cap-active      { background: #14532d; color: #4ade80; }
.cap-archived    { background: #450a0a; color: #f87171; }

/* ── Highlight cards ─────────────────────────────────────────────── */
.highlight-card {
  background: #0d1015; border: 1px solid #1e3a5f; border-radius: 8px;
  padding: 14px 16px;
}
.highlight-card + .highlight-card { margin-top: 12px; }
.highlight-card h3 { font-size: 0.82rem; font-weight: 600; color: #60a5fa; margin-bottom: 6px; }
.highlight-card p  { font-size: 0.78rem; color: #64748b; line-height: 1.55; }
.highlight-card a  { color: #60a5fa; text-decoration: none; }
.highlight-card a:hover { text-decoration: underline; }

/* ── WiFi setup form ─────────────────────────────────────────────── */
.ota-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.ota-field { display: flex; flex-direction: column; gap: 4px; }
.ota-label { font-size: 0.78rem; color: #64748b; }
.ota-input {
  background: #0d1015; border: 1px solid #1e2230; border-radius: 6px;
  color: #e2e8f0; font-size: 0.85rem; padding: 8px 12px;
  font-family: monospace; width: 100%; transition: border-color .15s;
}
.ota-input:focus { outline: none; border-color: rgba(245,158,11,.4); }
.ota-pw-wrap { position: relative; }
.ota-pw-wrap .ota-input { padding-right: 68px; }
.ota-pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #64748b; font-size: 0.75rem;
  cursor: pointer; font-family: inherit; padding: 2px 4px;
}
.ota-pw-toggle:hover { color: #94a3b8; }
.ota-generate-btn {
  align-self: flex-start; margin-top: 4px;
  background: #1a2443; border: 1px solid rgba(245,158,11,.3); border-radius: 6px;
  color: #f59e0b; font-size: 0.82rem; padding: 9px 18px; cursor: pointer;
  font-family: inherit; transition: background .15s;
}
.ota-generate-btn:hover { background: #1e2a52; }
.ota-output { margin-top: 16px; }
.ota-actions { display: flex; gap: 10px; margin-top: 10px; }
.ota-copy-btn, .ota-dl-btn {
  background: #141720; border: 1px solid #1e2230; border-radius: 6px;
  color: #94a3b8; font-size: 0.78rem; padding: 7px 14px; cursor: pointer;
  font-family: inherit; transition: border-color .15s, color .15s;
}
.ota-copy-btn:hover, .ota-dl-btn:hover { border-color: #334155; color: #e2e8f0; }
.ota-table-gap { margin-top: 14px; }
.ota-prose-gap { margin-top: 12px; }

/* ── BLE capability grid ─────────────────────────────────────────── */
.ble-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px;
  margin-top: 6px;
}
.ble-item {
  background: #0d1015; border: 1px solid #1e2230; border-radius: 7px;
  padding: 10px 12px;
}
.ble-item-icon { font-size: 1.1rem; margin-bottom: 4px; }
.ble-item-title { font-size: 0.78rem; font-weight: 600; color: #e2e8f0; }
.ble-item-desc  { font-size: 0.7rem; color: #64748b; margin-top: 2px; line-height: 1.4; }
