/* ============================================
   SiteProbe — Design System
   Dark theme with glassmorphism, gradients,
   and micro-animations
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Colors */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-glass: rgba(255, 255, 255, 0.08);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Accent Colors */
  --accent-primary: #6366f1;
  --accent-primary-glow: rgba(99, 102, 241, 0.3);
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);

  /* Score Colors */
  --score-a: #22c55e;
  --score-b: #84cc16;
  --score-c: #eab308;
  --score-d: #f97316;
  --score-f: #ef4444;

  /* Category Colors */
  --perf-color: #3b82f6;
  --seo-color: #8b5cf6;
  --security-color: #22c55e;
  --a11y-color: #f59e0b;
  --links-color: #ec4899;
  --sensitive-color: #f43f5e;
  --dns-color: #0ea5e9;
  --tech-color: #a855f7;
  --carbon-color: #16a34a;
  --cookies-color: #fb923c;

  /* Sizing */
  --max-width: 1200px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }

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

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 0;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(10, 14, 26, 0.8);
  border-bottom: 1px solid var(--border-glass);
}

.nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.nav-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}
.nav-links a:hover { color: var(--text-primary); }

/* ---------- Hero Section ---------- */
.hero {
  padding: 160px 0 80px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.hero-badge .dot {
  width: 6px;
  height: 6px;
  background: var(--score-a);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

.hero h1 {
  margin-bottom: 20px;
}

.hero h1 .gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
}

/* ---------- Scan Form ---------- */
.scan-form-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

.scan-form {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 6px;
  backdrop-filter: blur(12px);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.scan-form:focus-within {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 0 4px var(--accent-primary-glow);
}

.scan-form input[type="text"] {
  flex: 1;
  background: transparent;
  border: none;
  padding: 16px 20px;
  font-size: 1.05rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

.scan-form input::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--accent-gradient);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-base);
  white-space: nowrap;
  font-family: inherit;
}

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

.btn-primary:active {
  transform: translateY(0);
}

/* ---------- Loading / HTMX Indicator ---------- */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--text-secondary);
}

.htmx-request .btn-primary {
  opacity: 0.7;
  pointer-events: none;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Feature Grid ---------- */
.features {
  padding: 80px 0;
}

.features h2 {
  text-align: center;
  margin-bottom: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
  transition: transform var(--transition-base), border-color var(--transition-base);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.2);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.feature-icon.perf   { background: rgba(59, 130, 246, 0.15); color: var(--perf-color); }
.feature-icon.seo    { background: rgba(139, 92, 246, 0.15); color: var(--seo-color); }
.feature-icon.sec    { background: rgba(34, 197, 94, 0.15); color: var(--security-color); }
.feature-icon.a11y   { background: rgba(245, 158, 11, 0.15); color: var(--a11y-color); }
.feature-icon.links  { background: rgba(236, 72, 153, 0.15); color: var(--links-color); }

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

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ---------- Score Cards (Report) ---------- */
.scores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  backdrop-filter: blur(12px);
  transition: transform var(--transition-base);
}

.score-card:hover {
  transform: translateY(-2px);
}

.score-gauge {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 12px;
}

.score-gauge svg {
  transform: rotate(-90deg);
  width: 100px;
  height: 100px;
}

.score-gauge .bg-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 8;
}

.score-gauge .score-ring {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-gauge .score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  font-weight: 800;
}

.score-card .score-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Score colors by grade */
.grade-a .score-ring, .grade-a .score-value { stroke: var(--score-a); color: var(--score-a); }
.grade-b .score-ring, .grade-b .score-value { stroke: var(--score-b); color: var(--score-b); }
.grade-c .score-ring, .grade-c .score-value { stroke: var(--score-c); color: var(--score-c); }
.grade-d .score-ring, .grade-d .score-value { stroke: var(--score-d); color: var(--score-d); }
.grade-f .score-ring, .grade-f .score-value { stroke: var(--score-f); color: var(--score-f); }
.grade-na .score-value { color: var(--text-muted); font-size: 0.9rem; }
.grade-na .bg-ring { stroke: rgba(100, 116, 139, 0.2); }

/* ---------- Findings List ---------- */
.report-section {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
}

.report-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.report-section-header .icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.report-section-header h3 {
  flex: 1;
}

.report-section-header .section-score {
  font-size: 1.4rem;
  font-weight: 800;
}

.findings-list {
  display: flex;
  flex-direction: column;
}

.finding-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-glass);
}

.finding-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.finding-severity {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
}

.severity-critical { background: var(--score-f); box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
.severity-warning  { background: var(--score-d); box-shadow: 0 0 8px rgba(249, 115, 22, 0.3); }
.severity-info     { background: var(--score-c); }
.severity-pass     { background: var(--score-a); }

.finding-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.finding-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------- Dashboard ---------- */
.scan-history-table {
  width: 100%;
  border-collapse: collapse;
}

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

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

.scan-history-table tr:hover {
  background: var(--bg-glass);
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 28px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.score-badge.grade-a { background: rgba(34, 197, 94, 0.15); color: var(--score-a); }
.score-badge.grade-b { background: rgba(132, 204, 22, 0.15); color: var(--score-b); }
.score-badge.grade-c { background: rgba(234, 179, 8, 0.15); color: var(--score-c); }
.score-badge.grade-d { background: rgba(249, 115, 22, 0.15); color: var(--score-d); }
.score-badge.grade-f { background: rgba(239, 68, 68, 0.15); color: var(--score-f); }

/* ---------- Pricing ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  padding: 60px 0;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 32px;
  backdrop-filter: blur(12px);
  transition: transform var(--transition-base);
  position: relative;
}

.pricing-card:hover {
  transform: translateY(-4px);
}

.pricing-card.featured {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 40px var(--accent-primary-glow);
}

.pricing-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 16px;
  background: var(--accent-gradient);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
}

.pricing-card .plan-name {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px;
}

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

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

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

.pricing-features {
  list-style: none;
  margin-bottom: 28px;
}

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

.pricing-features .check {
  color: var(--score-a);
  font-size: 1rem;
}

.pricing-features .cross {
  color: var(--text-muted);
  font-size: 1rem;
}

.btn-plan {
  display: block;
  width: 100%;
  padding: 12px;
  text-align: center;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border-glass);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: inherit;
}

.btn-plan:hover {
  background: var(--bg-glass);
  border-color: rgba(99, 102, 241, 0.3);
}

.btn-plan.primary {
  background: var(--accent-gradient);
  border: none;
  color: white;
}

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

/* ---------- Module Tags (Pricing) ---------- */
.module-tag {
  display: inline-block;
  padding: 6px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

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

/* ---------- Scan Results Area ---------- */
#scan-results {
  max-width: 680px;
  margin: 20px auto 0;
}

.scan-complete-card {
  background: var(--bg-card);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  backdrop-filter: blur(12px);
  animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.scan-complete-card .overall-score {
  font-size: 3.5rem;
  font-weight: 900;
  margin: 12px 0 8px;
}

.mini-scores {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.mini-score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.mini-score .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .nav-links { gap: 16px; }
  .scan-form { flex-direction: column; }
  .scan-form input[type="text"] { padding: 14px 16px; }
  .btn-primary { justify-content: center; }
  .scores-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .hero { padding: 120px 0 60px; }
  .scores-grid { grid-template-columns: 1fr 1fr; }
}
