/* =========================================================
   WebLiveStatus — template stylesheet
   Pure CSS, no frameworks. Shared by index.html and dashboard.html
   ========================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --text: #14171c;
  --text-muted: #5f6672;
  --brand: #3b5bfd;
  --brand-hover: #2c47d8;
  --brand-soft: #e8edff;

  --up: #0f9d58;
  --up-soft: #e3f6ec;
  --down: #e5383b;
  --down-soft: #fde8e8;
  --warn: #d98b00;
  --warn-soft: #fff4dc;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --max: 1120px;
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --surface: #161a21;
  --surface-2: #1d222b;
  --border: #2a303b;
  --text: #e8ebf0;
  --text-muted: #9aa3b2;
  --brand: #6f86ff;
  --brand-hover: #8a9cff;
  --brand-soft: #1f2747;
  --up: #3ccf86;
  --up-soft: #12301f;
  --down: #ff6467;
  --down-soft: #3a1618;
  --warn: #f2b33d;
  --warn-soft: #3a2c0f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd {
  font-family: var(--mono);
  font-size: .85em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--text-muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Buttons, chips, pills ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .95rem;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--down); border-color: var(--border); }
.btn-danger:hover { background: var(--down-soft); }
.btn-sm { padding: 8px 14px; font-size: .875rem; }
.btn[disabled] { opacity: .6; cursor: progress; }

.chip {
  font: inherit; font-size: .85rem;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 999px;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-up { color: var(--up); background: var(--up-soft); }
.pill-down { color: var(--down); background: var(--down-soft); }
.pill-warn { color: var(--warn); background: var(--warn-soft); }
.pill-neutral { color: var(--text-muted); background: var(--surface-2); }

.link-btn {
  font: inherit; font-size: .875rem; color: var(--brand);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 4px var(--up-soft);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--up-soft); }
  50% { box-shadow: 0 0 0 7px var(--up-soft); }
}

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  color: var(--text-muted); font-weight: 500; font-size: .95rem;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.main-nav a:hover, .main-nav a.active { color: var(--text); background: var(--surface-2); text-decoration: none; }
.theme-toggle {
  font-size: 1.1rem; width: 38px; height: 38px; margin-left: 6px;
  border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; padding: 8px; cursor: pointer;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }

/* ---------- 5. Hero + checker ---------- */
.hero {
  padding: 72px 0 40px;
  text-align: center;
  background:
    radial-gradient(600px 240px at 50% 0%, var(--brand-soft), transparent 70%);
}
.hero-inner { max-width: 760px; }
.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 14px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; }
.lead { font-size: 1.1rem; color: var(--text-muted); max-width: 560px; margin: 0 auto 28px; }

.check-form {
  display: flex; gap: 8px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  max-width: 620px; margin: 0 auto;
}
.check-form input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 1.05rem;
  padding: 12px 14px;
  border: 0; outline: none;
  background: transparent; color: var(--text);
}
.check-form:focus-within { border-color: var(--brand); }
.form-error { color: var(--down); font-size: .9rem; min-height: 1.4em; margin: 10px 0 0; }

.quick-checks { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 14px; font-size: .9rem; }

/* ---------- 6. Result card ---------- */
.result-card {
  max-width: 760px; margin: 8px auto 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--text-muted);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: rise .25s ease-out;
}
.result-card.is-up { border-left-color: var(--up); }
.result-card.is-down { border-left-color: var(--down); }
.result-card.is-checking { border-left-color: var(--warn); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.result-main { display: flex; align-items: center; gap: 16px; }
.status-icon {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.5rem; font-weight: 800;
  background: var(--surface-2); color: var(--text-muted);
}
.is-up .status-icon { background: var(--up-soft); color: var(--up); }
.is-down .status-icon { background: var(--down-soft); color: var(--down); }
.is-checking .status-icon { background: var(--warn-soft); color: var(--warn); }
.is-checking .status-icon::after {
  content: ""; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-domain { font-family: var(--mono); font-size: .9rem; color: var(--text-muted); margin: 0; }
.result-text { font-size: 1.35rem; font-weight: 700; margin: 0; }

.result-meta {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 20px 0; padding: 16px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.result-meta dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.result-meta dd { margin: 2px 0 0; font-weight: 600; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- 7. Ad slots ---------- */
.ad-slot {
  display: grid; place-items: center;
  color: var(--text-muted); font-size: .8rem; letter-spacing: .04em;
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--surface) 10px, var(--surface) 20px);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.ad-leaderboard { height: 90px; max-width: 728px; margin: 0 auto 48px; }
.ad-box { min-height: 250px; }

/* ---------- 8. Guide cards ---------- */
.guides { padding: 24px 0 56px; }
.section-title { font-size: 1.75rem; font-weight: 800; text-align: center; }
.section-sub { text-align: center; color: var(--text-muted); margin-bottom: 32px; }

.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--text-muted);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
}
.guide-up { border-top-color: var(--up); }
.guide-down { border-top-color: var(--down); }
.guide-owner { border-top-color: var(--brand); }
.guide-card.is-highlighted { transform: translateY(-4px); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.guide-card h3 { font-size: 1.2rem; margin-top: 12px; }
.guide-card header p { font-size: .92rem; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 16px; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 10px 0 10px 40px;
  border-top: 1px solid var(--border);
  font-size: .93rem;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 10px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .78rem; font-weight: 700;
  background: var(--surface-2); color: var(--text);
}
.guide-up .steps li::before { background: var(--up-soft); color: var(--up); }
.guide-down .steps li::before { background: var(--down-soft); color: var(--down); }
.guide-owner .steps li::before { background: var(--brand-soft); color: var(--brand); }

/* ---------- 9. Panels, recent list ---------- */
.two-col { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; margin-bottom: 56px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 12px; }
.panel-title { font-size: 1.1rem; margin: 0; }

.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.recent-list li:first-child { border-top: 0; }
.recent-list .domain { font-family: var(--mono); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-list .meta { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--text-muted); flex: none; }
.recent-list .empty { color: var(--text-muted); justify-content: center; }

/* ---------- 10. FAQ ---------- */
.faq { max-width: 760px; margin-bottom: 72px; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 20px;
  margin-bottom: 10px;
}
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--text-muted); font-weight: 400; font-size: 1.2rem; }
.faq details[open] summary::after { content: "−"; }

/* ---------- 11. Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--text-muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-inner p { margin: 0; }
.footer-inner nav { display: flex; gap: 18px; }
.footer-inner a { color: var(--text-muted); }

/* =========================================================
   DASHBOARD
   ========================================================= */
.dash { padding: 36px 0 72px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.dash-head h1 { font-size: 1.9rem; margin: 0; }
.dash-head p { margin: 4px 0 0; color: var(--text-muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.9rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-up .stat-value { color: var(--up); }
.stat-down .stat-value { color: var(--down); }

.dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.dash-grid > *, .two-col > * { min-width: 0; }   /* lets the wide table scroll instead of stretching the page */

/* Monitor table */
.table-wrap { position: relative; overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
.monitor-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 640px; }
.monitor-table th {
  text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600;
  padding: 10px 8px; border-bottom: 1px solid var(--border);
}
.monitor-table td { padding: 14px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.monitor-table tr:last-child td { border-bottom: 0; }
.monitor-table tr.is-paused td { opacity: .55; }
.monitor-table .url { font-family: var(--mono); font-weight: 600; }
.monitor-table .sub { display: block; font-size: .8rem; color: var(--text-muted); font-family: var(--font); font-weight: 400; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
  font: inherit; font-size: .8rem; font-weight: 600;
  padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.danger:hover { background: var(--down-soft); color: var(--down); border-color: var(--down-soft); }

.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.empty-state strong { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }

/* Uptime bar (last 20 checks) */
.uptime-bar { display: flex; gap: 2px; height: 18px; }
.uptime-bar span { flex: 1; min-width: 3px; border-radius: 2px; background: var(--surface-2); }
.uptime-bar span.u { background: var(--up); }
.uptime-bar span.d { background: var(--down); }

/* Form */
.form-grid { display: grid; gap: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  font: inherit; font-size: .95rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.field input:focus, .field select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.field input[type="checkbox"] { width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--brand); }
.field-hint { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; cursor: pointer; }
.form-actions { display: flex; gap: 8px; }

/* Activity log */
.log { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.log li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); font-size: .85rem; }
.log li:first-child { border-top: 0; }
.log time { color: var(--text-muted); font-family: var(--mono); font-size: .78rem; flex: none; padding-top: 1px; }
.log .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 7px; background: var(--text-muted); }
.log .dot.u { background: var(--up); }
.log .dot.d { background: var(--down); }

.stack { display: grid; gap: 20px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 12. Responsive ---------- */
@media (max-width: 960px) {
  .guide-grid { grid-template-columns: 1fr; }
  .two-col, .dash-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ad-box { min-height: 120px; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
  }
  .main-nav.open { display: flex; }
  .theme-toggle { margin: 8px 0 0; align-self: flex-start; }

  .hero { padding: 48px 0 28px; }
  .check-form { flex-direction: column; }
  .check-form .btn { width: 100%; }
  .result-meta { grid-template-columns: 1fr; }
  .ad-leaderboard { height: 60px; }
  .field-row { grid-template-columns: 1fr; }
}
