/* ============================================================
   ProxyGate - Shared Styles
   Minimal dark theme inspired by GitHub/Linear/Vercel
   ============================================================ */

/* --- Variables --- */
:root {
  /* Colors */
  --bg: #0d1117;
  --bg-subtle: #161b22;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --border: rgba(240, 246, 252, 0.1);
  --border-subtle: rgba(240, 246, 252, 0.06);
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-subtle: #6e7681;
  --blue: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --purple: #bc8cff;
  --cyan: #39d2c0;
  /* Aliases */
  --primary: var(--blue);
  --accent: var(--blue);
  --accent-2: var(--purple);
  --danger: var(--red);
  --success: var(--green);
  /* Spacing (8px system) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 16px;
  --sp-4: 24px;
  --sp-5: 32px;
  --sp-6: 48px;
  --sp-7: 64px;
  /* Radius */
  --radius: 12px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
}

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

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

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

/* --- Typography --- */
h1 { font-size: 2.25rem; font-weight: 700; letter-spacing: -0.025em; margin-bottom: var(--sp-3); line-height: 1.2; color: var(--text); }
h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: var(--sp-3); }
h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: var(--sp-2); }
p { margin-bottom: var(--sp-3); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.lead { font-size: 1.125rem; color: var(--text-muted); margin-bottom: var(--sp-4); }
.preview-note { font-size: 0.875rem; color: var(--text-subtle); font-style: italic; }

/* --- Layout --- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--sp-3);
}

/* --- Navigation --- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  display: inline-block;
}

.nav-links {
  display: flex;
  gap: var(--sp-4);
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-active { color: var(--text) !important; }

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  margin-bottom: var(--sp-3);
}

.card-header {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.card-body { padding: var(--sp-3); }

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font);
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}

.btn:hover { background: var(--bg-card); border-color: var(--text-subtle); text-decoration: none; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: #4090e0; border-color: #4090e0; }

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

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

.btn-block { width: 100%; }

.btn-sm { padding: 6px 12px; font-size: 0.8125rem; }

/* --- Pills --- */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.1);
  color: var(--primary);
  border: 1px solid rgba(88, 166, 255, 0.2);
}

.pill-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }

.security-pill {
  background: rgba(63, 185, 80, 0.1);
  color: var(--success);
  border-color: rgba(63, 185, 80, 0.2);
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  text-align: center;
}

.stat-label { font-size: 0.7rem; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--sp-1); }
.stat-value { font-size: 1.5rem; font-weight: 700; }

.rate-good, .latency-good { color: var(--success); }
.rate-warn, .latency-warn { color: var(--yellow); }
.rate-bad, .latency-bad { color: var(--danger); }

/* --- Proxy List --- */
.proxy-list {
  list-style: none;
  background: rgba(13, 17, 23, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  max-height: 160px;
  overflow-y: auto;
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.7;
}
.proxy-list li {
  color: var(--green);
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feature-list { list-style: none; padding: 0; }
.feature-list li {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.feature-list li:last-child { border-bottom: none; }

/* --- Trust Section --- */
.trust { margin: var(--sp-5) 0; }
.trust-stats { display: flex; justify-content: center; gap: var(--sp-6); flex-wrap: wrap; }
.trust-item { text-align: center; }
.trust-number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.trust-label { font-size: 0.8125rem; color: var(--text-muted); }

/* --- Security Index --- */
.security { margin: var(--sp-4) 0; }
.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-3);
}
.security-feature {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
}

/* --- Pricing --- */
.pricing { margin: var(--sp-4) 0; }
.pricing-subtitle { color: var(--text-muted); margin-bottom: var(--sp-4); }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-3);
}

.tier-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  position: relative;
  transition: border-color 0.15s;
}

.tier-card:hover { border-color: var(--text-subtle); }

.tier-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.tier-duration { font-size: 1.125rem; font-weight: 600; margin-bottom: var(--sp-2); }
.tier-cta { margin-top: var(--sp-3); }

.most-popular-badge, .best-value-badge {
  position: absolute;
  top: -10px;
  right: var(--sp-3);
  background: var(--primary);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.best-value-badge { background: var(--success); }

.price { margin-bottom: var(--sp-3); }
.price-amount { font-size: 2.5rem; font-weight: 700; }
.price-perday-line { font-size: 0.8125rem; color: var(--text-muted); }
.price-perday-val { color: var(--text); font-weight: 500; }
.price-compare { font-size: 0.8125rem; color: var(--text-subtle); text-decoration: line-through; }
.price-sub { font-size: 0.8125rem; color: var(--text-muted); }

/* --- Payment / Tier Select --- */
.payment-container { max-width: 600px; margin: 0 auto; }

.tier-select { display: flex; gap: 0.75rem; margin: 1.25rem 0; }
.tier-option { flex: 1; cursor: pointer; }
.tier-option input { display: none; }
.tier-option .card { padding: 1rem; text-align: center; border: 1px solid var(--border); transition: border-color 0.2s, box-shadow 0.2s; cursor: pointer; }
.tier-option input:checked + .card { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }

.tier-name { font-weight: 600; }
.tier-price { font-size: 1.125rem; font-weight: 700; }
.tier-perday { font-size: 0.8125rem; color: var(--text-muted); }
.tier-badge { font-size: 0.6875rem; color: var(--success); font-weight: 500; }

/* --- Iframe --- */
#trocador-frame {
  width: 100%;
  min-height: 500px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* --- Status --- */
.status-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
}

.status-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- Forms --- */
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: var(--sp-1); color: var(--text-muted); }

input[type="email"],
input[type="text"],
textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.875rem;
  font-family: var(--font);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

input[type="email"]:focus,
input[type="text"]:focus,
textarea:focus {
  border-color: var(--primary);
}

.alert {
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: var(--sp-3);
  border: 1px solid var(--border);
}

.alert-error { background: rgba(248, 81, 73, 0.1); border-color: rgba(248, 81, 73, 0.3); color: var(--danger); }
.alert-success { background: rgba(63, 185, 80, 0.1); border-color: rgba(63, 185, 80, 0.3); color: var(--success); }

.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.5;
}

/* --- Success Box --- */
#success-box {
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-radius: var(--radius);
  padding: var(--sp-4);
  text-align: center;
  color: var(--success);
}

/* --- Hidden --- */
.hidden { display: none !important; }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-crypto { background: rgba(188, 140, 255, 0.15); color: var(--purple); }
.badge-anonymous { background: rgba(57, 210, 192, 0.15); color: var(--cyan); }
.badge-public { background: rgba(88, 166, 255, 0.15); color: var(--blue); }
.badge-auth { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.badge-admin { background: rgba(248, 81, 73, 0.15); color: var(--red); }

/* --- API Docs --- */
.api-section { margin-bottom: var(--sp-5); }

.endpoint {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--sp-3);
  overflow: hidden;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.method {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.method-get { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.method-post { background: rgba(88, 166, 255, 0.15); color: var(--blue); }

.endpoint-path { font-family: var(--font-mono); font-size: 0.875rem; font-weight: 500; }
.endpoint-desc { padding: var(--sp-2) var(--sp-3); font-size: 0.875rem; color: var(--text-muted); }

.code-wrapper { position: relative; }

.copy-btn {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  padding: 4px 10px;
  font-size: 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
}

.copy-btn:hover { color: var(--text); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

.label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; margin-bottom: var(--sp-1); }
.rate-limit { font-size: 0.8125rem; color: var(--text-subtle); margin-top: var(--sp-2); }

.quickstart-step { margin-bottom: var(--sp-3); }
.quickstart-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  margin-right: var(--sp-2);
}
.quickstart-content { margin-left: 36px; }

.toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.toc a { display: block; font-size: 0.875rem; color: var(--text-muted); padding: 4px 0; }
.toc a:hover { color: var(--text); text-decoration: none; }

.divider { border: none; border-top: 1px solid var(--border); margin: var(--sp-4) 0; }

/* --- Security Page --- */
.security-hero {
  text-align: center;
  padding: var(--sp-7) 0 var(--sp-5);
}

.section-block { margin-bottom: var(--sp-5); }
.section-desc { color: var(--text-muted); margin-bottom: var(--sp-3); }

.process-steps { display: flex; flex-direction: column; gap: var(--sp-3); }

.process-step {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 0.875rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  flex-shrink: 0;
}

.threat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-3);
}

.threat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
}

.threat-card.danger { border-color: rgba(248, 81, 73, 0.3); }

.methodology-list {
  list-style: none;
  padding: 0;
}

.methodology-list li {
  padding: var(--sp-2) 0;
  padding-left: var(--sp-4);
  position: relative;
  color: var(--text-muted);
}

.methodology-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

.live-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
}

.live-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  text-align: center;
}

.stat-icon { font-size: 1.5rem; margin-bottom: var(--sp-1); }
.stat-number { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 2px; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); }

.stats-loading { text-align: center; padding: var(--sp-4); color: var(--text-muted); }
.refresh-note { font-size: 0.8125rem; color: var(--text-subtle); text-align: center; margin-top: var(--sp-2); }

.highlight-box {
  background: rgba(88, 166, 255, 0.06);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: var(--radius);
  padding: var(--sp-3);
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: var(--sp-5) var(--sp-3);
  border-top: 1px solid var(--border);
  margin-top: var(--sp-7);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

/* --- Responsive --- */
@media (max-width: 768px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .nav { flex-direction: column; gap: var(--sp-2); }
  .nav-links { flex-wrap: wrap; justify-content: center; gap: var(--sp-2); }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: 1fr; }
  .security-grid { grid-template-columns: 1fr; }
  .threat-grid { grid-template-columns: 1fr; }
  .live-stats-grid { grid-template-columns: repeat(2, 1fr); }

  .trust-stats { gap: var(--sp-4); }
  .security-hero { padding: var(--sp-5) 0 var(--sp-4); }
}

@media (max-width: 480px) {
  .container { padding: 0 var(--sp-2); }
  .stats-grid { grid-template-columns: 1fr; }
  .live-stats-grid { grid-template-columns: 1fr; }

  .price-amount { font-size: 2rem; }

  .endpoint-header { flex-wrap: wrap; }

  .btn { padding: 8px 16px; font-size: 0.8125rem; }
}

/* ============================================================
   Patches — missing variables, aliases, and utility classes
   ============================================================ */

/* Variable aliases for backward compat */
:root {
  --muted: var(--text-muted);
  --accent-glow: rgba(88, 166, 255, 0.15);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Hero section (index.html) */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
  margin-bottom: 4rem;
}

@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; }
}

/* Container variants */
.container-narrow { max-width: 720px; }

/* Button grid */
.btn-grid { display: grid; gap: 0.5rem; margin-bottom: 1rem; }

/* Textarea */
.textarea-full {
  width: 100%; resize: vertical;
  padding: 0.75rem 1rem; border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.6);
  color: var(--text); font-size: 0.95rem;
  font-family: inherit; margin-bottom: 1rem;
  transition: border-color 0.2s;
}
.textarea-full:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.1);
}

/* Form row */
.form-row {
  display: flex; gap: 0.75rem; flex-wrap: wrap;
  margin-top: 0.75rem; align-items: center;
}

/* Code block pre */
.code-block-pre { white-space: pre-wrap; margin-top: 0.75rem; }

/* Alert result */
.alert-result { margin-top: 1rem; }

/* Stats grid 2-col variant (security page) */
.stats-grid-2col {
  margin-top: 1.5rem; display: grid;
  grid-template-columns: repeat(2, 1fr); gap: 1rem;
}
@media (max-width: 700px) { .stats-grid-2col { grid-template-columns: 1fr; } }

/* Pill row centered */
.pill-row-center { justify-content: center; }

/* TOC heading */
.toc-heading { margin-bottom: 0.5rem; }

/* Accent-2 text color */
.accent-2 { color: var(--accent-2); }

/* Error codes section */
.error-codes-section { margin-top: 1rem; }
