/* =============================================
   Pulse Analytics — Light Theme CSS (white + blue)
   ============================================= */

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

:root {
  --bg: #ffffff;
  --card: #f8fafc;
  --card-hover: #f1f5f9;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-hover: #3b82f6;
  --accent-glow: rgba(37, 99, 235, 0.10);
  --text: #0f172a;
  --muted: #64748b;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- NAV ---- */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span { color: var(--accent); }

nav ul {
  display: flex;
  align-items: center;
  gap: 28px;
}

nav ul a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}

nav ul a:hover { color: var(--text); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 30px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius); }

/* ---- LANDING ---- */
.landing { padding-top: 64px; }

/* Hero */
.hero {
  padding: 120px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -200px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
  position: relative;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.accent { color: var(--accent); }

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

.hero-stats div { text-align: center; }
.hero-stats .number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
}
.hero-stats .label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Features */
.features {
  padding: 100px 0;
}

.features h2 {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.features > .container > p {
  text-align: center;
  color: var(--muted);
  margin-bottom: 56px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: var(--accent);
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.08);
}

.feature-card .icon {
  width: 48px; height: 48px;
  background: var(--accent-glow);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 20px;
  color: var(--accent);
}

.feature-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.feature-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

/* CTA */
.cta {
  padding: 100px 0;
  text-align: center;
}

.cta h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.cta p {
  color: var(--muted);
  margin-bottom: 32px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 960px;
  margin: 0 auto;
  padding: 60px 0;
}

.pricing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  transition: all var(--transition);
}

.pricing-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.pricing-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 40px var(--accent-glow);
  position: relative;
}

.pricing-card.featured::before {
  content: "Popular";
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
}

.pricing-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.pricing-card .price {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 16px 0 4px;
}

.pricing-card .price span {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
}

.pricing-card .desc {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

.plan-features {
  text-align: left;
  margin-bottom: 28px;
}

.plan-features li {
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.plan-features li::before {
  content: "✓";
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 48px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

/* ---- AUTH ---- */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-card .btn { width: 100%; margin-top: 8px; }

.auth-card .footer-text {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---- DASHBOARD ---- */
.dashboard {
  display: flex;
  min-height: 100vh;
  padding-top: 0;
}

.sidebar {
  width: 240px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow: visible;
  z-index: 100;
}

.sidebar .logo {
  padding: 0 20px 24px;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar nav { position: static; background: none; backdrop-filter: none; border: none; }
.sidebar nav ul { flex-direction: column; gap: 2px; padding: 0 8px; }
.sidebar nav ul a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.88rem;
}
.sidebar nav ul a:hover,
.sidebar nav ul a.active {
  background: var(--accent-glow);
  color: var(--text);
}

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
  min-width: 0;
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--accent); }

.stat-card .label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 1.8rem;
  font-weight: 800;
}

.stat-card .change {
  font-size: 0.8rem;
  margin-top: 6px;
}

.stat-card .change.up { color: var(--success); }
.stat-card .change.down { color: var(--danger); }

/* Charts & Tables */
.chart-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.chart-container h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.table tr:hover td { background: var(--card-hover); }

.top-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.top-list h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.top-list .item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.top-list .item:last-child { border-bottom: none; }

.top-list .item .name { font-size: 0.9rem; }
.top-list .item .count { color: var(--muted); font-size: 0.85rem; font-family: var(--mono); }

/* Period selector */
.period-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.period-selector .btn {
  padding: 6px 16px;
  font-size: 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
}

.period-selector .btn.active,
.period-selector .btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--text);
}

/* Realtime badge */
.realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--success);
}

.realtime-badge::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
}

/* Site selector */
.site-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.site-selector select {
  max-width: 280px;
}

/* Settings */
.settings-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

.settings-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ---- UTILITIES ---- */
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* Flash messages */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.flash.success { background: rgba(22, 163, 74, 0.1); color: var(--success); border: 1px solid rgba(22, 163, 74, 0.2); }
.flash.error { background: rgba(220, 38, 38, 0.1); color: var(--danger); border: 1px solid rgba(220, 38, 38, 0.2); }
.flash.info { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(37, 99, 235, 0.20); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; padding: 20px; }

  .hero { padding: 80px 0 60px; }
  .hero h1 { font-size: 2rem; }
  .hero-stats { flex-direction: column; gap: 24px; }

  .feature-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }

  nav ul { gap: 16px; }
  nav ul a { font-size: 0.82rem; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
  .period-selector { flex-wrap: wrap; }
}
