/* ============================================
   Transaction Warden — Plain CSS
   ============================================ */

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

:root {
  --primary: #0f172a;
  --primary-soft: #1e293b;
  --secondary: #3b82f6;
  --secondary-dark: #2563eb;
  --secondary-light: #93c5fd;
  --accent: #3b82f6;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --border: #e2e8f0;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  --radius: 8px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "Fira Code", "Monaco", "Consolas", "Courier New", monospace;
}

html { font-size: 16px; scroll-behavior: smooth; }

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

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

h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; }
h1 { font-size: 2.25rem; letter-spacing: -0.02em; }
h2 { font-size: 1.75rem; letter-spacing: -0.015em; }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; }
h4 { font-size: 1rem; }

p { margin-bottom: 1rem; }

img { max-width: 100%; }

/* --- Layout --- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.center { text-align: center; }

.section {
  padding: 4rem 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.125rem;
}

/* --- Navbar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  height: 60px;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1rem;
  flex-wrap: nowrap;
}

.nav-cta-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.nav-cta {
  padding: 0.4rem 0.875rem;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
}

.logo-icon { color: var(--secondary); }
.logo-text { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.625rem;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
  text-decoration: none;
}

.nav-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 0.5rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  font-family: var(--font);
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--secondary);
  color: white;
}

.btn-primary:hover {
  background: var(--secondary-dark);
}

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

.btn-outline:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.btn-outline-light {
  border-color: rgba(255, 255, 255, 0.3);
  color: white;
  background: transparent;
}

.btn-outline-light:hover {
  border-color: white;
  background: rgba(255, 255, 255, 0.1);
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* --- Chips --- */
.chip {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.chip-sm {
  font-size: 0.75rem;
  padding: 0.2rem 0.625rem;
}

.chip-info {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

.chip-accent {
  background: var(--secondary);
  color: white;
  border-color: var(--secondary);
}

/* --- Hero --- */
.hero {
  padding: 6rem 0 4rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.875rem, 4vw, 2.75rem);
  margin-bottom: 1.25rem;
  letter-spacing: -0.025em;
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 640px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

.chip-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.hero-note {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

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

/* --- Stats --- */
.stats {
  padding: 2.5rem 0;
  background: var(--primary-soft);
  color: white;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--secondary-light);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* --- Features --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.feature-card {
  padding: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.feature-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.feature-card h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.feature-card p { color: var(--text-secondary); margin: 0; font-size: 0.875rem; }

/* --- Detection Rules --- */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.rule-card {
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.rule-card:hover { border-color: #cbd5e1; }

.rule-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.rule-cat {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.severity-high   { background: #fee2e2; color: #991b1b; }
.severity-medium { background: #fef3c7; color: #92400e; }
.severity-low    { background: #dbeafe; color: #1e40af; }

.rule-timing {
  font-size: 0.75rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.rule-card h4 { margin-bottom: 0.5rem; font-size: 1rem; }
.rule-card p { color: var(--text-secondary); font-size: 0.875rem; margin: 0; }

/* --- Steps --- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  text-align: center;
}

.step-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--secondary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 auto 1.5rem;
}

.step h3 { margin-bottom: 0.75rem; }
.step p { color: var(--text-secondary); }

/* --- Code Blocks --- */
.code-block {
  background: #1e293b;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

.code-block pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e2e8f0;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.code-example {
  margin-top: 3rem;
}

.code-example pre {
  background: #1e293b;
  border-radius: var(--radius);
  padding: 2rem;
  overflow-x: auto;
  color: #e2e8f0;
  font-family: var(--mono);
  font-size: 0.875rem;
}

/* --- Response Blocks --- */
.response-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: white;
}

.response-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.http-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  color: white;
}

.status-ok  { background: var(--success); }
.status-err { background: var(--error); }

.response-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.response-block pre {
  margin: 0;
  padding: 1rem;
  font-size: 0.85rem;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* --- Endpoints (API Docs) --- */
.endpoint {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.endpoint:last-child { border-bottom: none; }

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.endpoint-header h3 {
  font-family: var(--mono);
  font-size: 1.25rem;
}

.endpoint-summary {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.endpoint-desc {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.method-chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.625rem;
  border-radius: 4px;
  color: white;
  text-transform: uppercase;
}

.method-post   { background: var(--success); }
.method-get    { background: var(--info); }
.method-delete { background: var(--error); }
.method-put    { background: var(--warning); }

/* --- Info / Sandbox boxes --- */
.info-box {
  background: #dbeafe;
  border: 1px solid var(--info);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 2rem;
}

.info-box h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.info-box code {
  font-family: var(--mono);
  font-size: 0.875rem;
}

.info-box > div + div { margin-top: 1rem; }

.sandbox-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.credentials {
  background: var(--bg-alt);
  padding: 1rem;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.875rem;
}

.credentials > div + div { margin-top: 0.5rem; }

.error-codes {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.error-code + .error-code { margin-top: 1rem; }
.error-code h4 { font-size: 0.9375rem; }
.error-code p  { color: var(--text-secondary); margin: 0; }

/* --- Compliance --- */
.compliance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.check-list { list-style: none; padding: 0; }
.check-list li {
  padding: 0.5rem 0;
  padding-left: 1.75rem;
  position: relative;
}
.check-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

.compliance-card {
  background: var(--primary-soft);
  color: white;
  padding: 2.5rem;
  border-radius: var(--radius);
}

.compliance-card p { opacity: 0.8; }

/* --- Pricing --- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.price-card {
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
}

.price-card h3 { margin: 0.5rem 0; }
.price-card p { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 1.5rem; }

.price {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

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

.price-card-featured { border: 2px solid var(--secondary); }

.price-card-dark {
  background: var(--primary-soft);
  color: white;
  border-color: var(--primary-soft);
}

.price-card-dark p { color: rgba(255, 255, 255, 0.7); }

/* --- Page header (docs / demo) --- */
.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 { margin: 0.5rem 0; }

.page-sub {
  color: var(--text-secondary);
  font-size: 1.125rem;
  max-width: 700px;
}

.page-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

/* --- Tutorial Steps (Demo) --- */
.tutorial-step {
  margin-bottom: 3rem;
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.step-heading .step-num {
  width: 32px;
  height: 32px;
  font-size: 0.875rem;
  margin: 0;
  flex-shrink: 0;
}

.step-desc {
  color: var(--text-secondary);
  margin-left: 2.75rem;
  margin-bottom: 1.5rem;
}

/* --- Register Form --- */
.register-card {
  max-width: 520px;
  margin: 0 auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

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

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.form-note {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 1rem;
}

.register-success {
  text-align: center;
  padding: 2rem;
  max-width: 520px;
  margin: 0 auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #dcfce7;
  color: var(--success);
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

/* --- HTMX indicator --- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request .submit-text { display: none; }

/* --- CTA --- */
.cta {
  padding: 4rem 0;
  background: var(--primary-soft);
  color: white;
}

.cta h2 { margin-bottom: 1rem; }
.cta p  { opacity: 0.8; margin-bottom: 2rem; }

/* --- 404 --- */
.not-found {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
}

.not-found-code {
  font-size: clamp(4rem, 10vw, 6rem);
  color: var(--text);
  margin-bottom: 0.5rem;
}

.not-found h2 {
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 1rem;
}

.not-found p { color: var(--text-secondary); margin-bottom: 2rem; }

/* --- Footer --- */
.footer {
  padding: 2rem 0;
  background: var(--primary-soft);
  color: white;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  text-decoration: none;
}

.footer-links a:hover { color: white; }

.footer-copy {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.875rem;
  width: 100%;
  text-align: center;
  margin-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
}

/* --- Spacer for fixed navbar --- */
main {
  padding-top: 60px;
}

/* --- Mobile menu button --- */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
}

.hamburger::before { top: -7px; }
.hamburger::after  { top: 7px; }

.mobile-menu-open .hamburger { background: transparent; }
.mobile-menu-open .hamburger::before { top: 0; transform: rotate(45deg); }
.mobile-menu-open .hamburger::after  { top: 0; transform: rotate(-45deg); }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    gap: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  }

  .mobile-menu-open .nav-links { display: flex; }

  .nav-links .nav-link {
    padding: 0.75rem 0;
    font-size: 1rem;
  }

  .nav-links .nav-divider {
    width: 100%;
    height: 1px;
    margin: 0.5rem 0;
  }

  .nav-cta-group { display: none; }
  .mobile-menu-btn { display: block; }

  .stats-grid        { grid-template-columns: repeat(2, 1fr); }
  .features-grid      { grid-template-columns: 1fr; }
  .rules-grid         { grid-template-columns: 1fr; }
  .steps-grid         { grid-template-columns: repeat(2, 1fr); }
  .compliance-grid    { grid-template-columns: 1fr; }
  .pricing-grid       { grid-template-columns: 1fr; }
  .form-row           { grid-template-columns: 1fr; }

  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; align-items: center; }
}
