/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #22263a;
  --border: #2e3248;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px; }

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

/* ===== Nav ===== */
nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(15,17,23,0.95);
  backdrop-filter: blur(10px); z-index: 100;
}
.nav-logo { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: var(--muted); font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.25rem; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1rem; }

/* ===== Hero ===== */
.hero {
  text-align: center; padding: 6rem 2rem 4rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.12) 0%, transparent 70%);
}
.hero-badge {
  display: inline-block; background: rgba(99,102,241,0.15); color: var(--accent);
  border: 1px solid rgba(99,102,241,0.3); border-radius: 50px;
  padding: 0.3rem 1rem; font-size: 0.8rem; font-weight: 600; margin-bottom: 1.5rem;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.15; margin-bottom: 1.25rem; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 560px; margin: 0 auto 2.5rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 2.5rem; justify-content: center; margin-top: 3rem; padding-top: 3rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.stat-item { text-align: center; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }

/* ===== Features ===== */
.features { padding: 5rem 2rem; max-width: 1100px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { font-size: 2rem; font-weight: 700; margin-bottom: 0.75rem; }
.section-header p { color: var(--muted); max-width: 500px; margin: 0 auto; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.feature-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.75rem; transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--accent); }
.feature-icon { font-size: 1.75rem; margin-bottom: 1rem; }
.feature-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.feature-card p { color: var(--muted); font-size: 0.875rem; }

/* ===== Pricing ===== */
.pricing { padding: 5rem 2rem; background: var(--bg2); }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; max-width: 960px; margin: 0 auto; }
.pricing-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2rem; position: relative;
}
.pricing-card.popular { border-color: var(--accent); }
.popular-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: 0.75rem; font-weight: 700;
  padding: 0.25rem 0.85rem; border-radius: 50px; white-space: nowrap;
}
.plan-name { font-size: 0.85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.plan-price { font-size: 2.5rem; font-weight: 800; margin-bottom: 0.25rem; }
.plan-price span { font-size: 1rem; font-weight: 400; color: var(--muted); }
.plan-desc { color: var(--muted); font-size: 0.875rem; margin-bottom: 1.5rem; }
.plan-features { list-style: none; margin-bottom: 2rem; }
.plan-features li { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
.plan-features li:last-child { border-bottom: none; }
.check { color: var(--green); font-weight: 700; }
.plan-cta { width: 100%; text-align: center; justify-content: center; }

/* ===== Dashboard ===== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo { padding: 1.25rem; font-size: 1.1rem; font-weight: 700; border-bottom: 1px solid var(--border); display: block; }
.sidebar-logo span { color: var(--accent); }
.sidebar-nav { display: flex; flex-direction: column; padding-top: 0.5rem; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.65rem 1.25rem; color: var(--muted); font-size: 0.875rem;
  transition: all 0.15s; border-left: 3px solid transparent; text-decoration: none;
}
.sidebar-nav a:hover, .sidebar-nav a.active { color: var(--text); background: var(--bg3); border-left-color: var(--accent); }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); margin-top: auto; }
.sidebar-user { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-content { flex: 1; overflow-y: auto; }
.page-header { padding: 1.5rem 2rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.page-header h1 { font-size: 1.25rem; font-weight: 700; }
.page-body { padding: 2rem; }

/* ===== Stats Cards ===== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-card-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.stat-card-value { font-size: 2rem; font-weight: 800; }
.stat-card-value.green { color: var(--green); }
.stat-card-value.red { color: var(--red); }

/* ===== Monitor List ===== */
.monitors-list { display: flex; flex-direction: column; gap: 0.75rem; }
.monitor-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; display: flex; align-items: center; gap: 1rem;
  transition: border-color 0.2s;
}
.monitor-card:hover { border-color: var(--accent); }
.monitor-status { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-up { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-down { background: var(--red); box-shadow: 0 0 8px var(--red); animation: pulse 1.5s infinite; }
.status-unknown { background: var(--muted); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.monitor-info { flex: 1; min-width: 0; }
.monitor-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.monitor-url { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.monitor-meta { display: flex; gap: 1.25rem; font-size: 0.8rem; color: var(--muted); flex-shrink: 0; }
.monitor-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 0.5rem; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2rem; width: 100%; max-width: 480px; box-shadow: var(--shadow);
}
.modal h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; }
input, select, textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.65rem 0.9rem; color: var(--text);
  font-size: 0.9rem; transition: border-color 0.15s; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.35rem; }

/* ===== Auth Page ===== */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2.5rem; width: 100%; max-width: 420px;
}
.auth-logo { text-align: center; font-size: 1.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.auth-logo span { color: var(--accent); }
.auth-subtitle { text-align: center; color: var(--muted); font-size: 0.875rem; margin-bottom: 2rem; }
.auth-toggle { text-align: center; margin-top: 1.25rem; font-size: 0.875rem; color: var(--muted); }
.auth-toggle a { cursor: pointer; }

/* ===== Plan Badge ===== */
.plan-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  padding: 0.15rem 0.5rem; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.06em;
}
.plan-free { background: rgba(148,163,184,0.15); color: var(--muted); }
.plan-team { background: rgba(99,102,241,0.2); color: var(--accent); }
.plan-business { background: rgba(245,158,11,0.2); color: var(--yellow); }

/* ===== Toast ===== */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 1.25rem; font-size: 0.875rem; box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ===== Uptime Bar ===== */
.uptime-bar { display: flex; gap: 2px; height: 24px; margin-top: 0.5rem; }
.uptime-segment { flex: 1; border-radius: 2px; }
.uptime-segment.up { background: var(--green); opacity: 0.7; }
.uptime-segment.down { background: var(--red); }
.uptime-segment.unknown { background: var(--bg3); }

/* ===== Footer ===== */
footer { padding: 3rem 2rem; border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: 0.875rem; }
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

/* ===== Tick Bar (monitor list history) ===== */
.tick-bar {
  display: flex; gap: 2px; margin-top: 0.5rem; align-items: center;
  height: 16px; overflow: hidden;
}
.tick-bar-empty { height: 16px; display: flex; align-items: center; margin-top: 0.5rem; }
.tick { display: inline-block; width: 4px; height: 16px; border-radius: 2px; flex-shrink: 0; }
.tick-up { background: var(--green); opacity: 0.75; }
.tick-down { background: var(--red); }

/* ===== Monitor Detail View ===== */
.detail-chart-container {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.detail-toggle-group {
  display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.detail-toggle {
  background: transparent; border: none; color: var(--muted); font-size: 0.8rem;
  padding: 0.3rem 0.7rem; cursor: pointer; transition: all 0.15s;
}
.detail-toggle:hover { color: var(--text); background: var(--bg3); }
.detail-toggle.active { background: var(--accent); color: #fff; }

/* Dataset toggle buttons (individual, color-coded) */
.ds-toggle {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); font-size: 0.78rem; padding: 0.3rem 0.65rem;
  cursor: pointer; transition: all 0.15s; opacity: 0.5;
}
.ds-toggle::before {
  content: ''; display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--c, #6366f1); flex-shrink: 0;
}
.ds-toggle.active { color: var(--text); opacity: 1; border-color: var(--c, var(--accent)); }
.ds-toggle:hover { opacity: 0.85; }
.incidents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.incidents-table thead th {
  text-align: left;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 0.75rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
.incidents-table tbody tr { border-bottom: 1px solid var(--border); }
.incidents-table tbody tr:last-child { border-bottom: none; }
.incidents-table tbody td {
  padding: 0.65rem 0.75rem;
  color: var(--text);
  vertical-align: middle;
}
.check-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.check-badge.check-up { background: rgba(34,197,94,0.15); color: var(--green); }
.check-badge.check-down { background: rgba(239,68,68,0.15); color: var(--red); }
.monitor-card-clickable { cursor: pointer; }

/* ===== Incidents Page ===== */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.filter-tab {
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-tab:hover { border-color: var(--accent); color: var(--text); }
.filter-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.incidents-table-wrap { overflow-x: auto; }
.incidents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.incidents-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.incidents-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.incidents-table tbody tr:last-child td { border-bottom: none; }
.incidents-table tbody tr:hover { background: var(--bg3); }
.incident-ongoing td { background: rgba(239, 68, 68, 0.06); }
.incident-ongoing:hover td { background: rgba(239, 68, 68, 0.1) !important; }
.incident-badge-ongoing {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 50px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
}
.incident-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}

/* ===== Hamburger / Mobile Sidebar ===== */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--bg3); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 149;
}
.sidebar-overlay.active { display: block; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .main-content { width: 100%; }
  .hamburger-btn { display: inline-flex; align-items: center; justify-content: center; }
  .hero { padding: 4rem 1.5rem 2.5rem; }
  .hero-stats { gap: 1.5rem; }
  .features, .pricing { padding: 3rem 1.5rem; }
  .page-body { padding: 1.25rem; }
  .page-header { padding: 1rem 1.25rem; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .monitor-meta { display: none; }
  .form-row { grid-template-columns: 1fr; }
}

/* ===== Incidents Page ===== */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.filter-tab {
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-tab:hover { border-color: var(--accent); color: var(--text); }
.filter-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.incidents-table-wrap { overflow-x: auto; }
.incidents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.incidents-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.incidents-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.incidents-table tbody tr:last-child td { border-bottom: none; }
.incidents-table tbody tr:hover { background: var(--bg3); }
.incident-ongoing td { background: rgba(239, 68, 68, 0.06); }
.incident-ongoing:hover td { background: rgba(239, 68, 68, 0.1) !important; }
.incident-badge-ongoing {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 50px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
}
.incident-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}
