/* ============================================================
   Security Headers Scanner - SinapseTech
   V.1.0.0
   ============================================================ */

/* --- Design Tokens --- */
:root {
  --deep: #080b16;
  --surface-0: #0d1117;
  --surface-1: rgba(255,255,255,0.03);
  --surface-2: rgba(255,255,255,0.06);
  --surface-3: rgba(255,255,255,0.09);
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);

  --indigo: #6366f1;
  --indigo-light: #818cf8;
  --indigo-dim: rgba(99,102,241,0.12);
  --cyan: #06b6d4;
  --cyan-light: #22d3ee;
  --cyan-dim: rgba(6,182,212,0.12);
  --emerald: #10b981;
  --emerald-light: #34d399;
  --emerald-dim: rgba(16,185,129,0.12);
  --amber: #f59e0b;
  --amber-light: #fbbf24;
  --amber-dim: rgba(245,158,11,0.12);
  --rose: #f43f5e;
  --rose-light: #fb7185;
  --rose-dim: rgba(244,63,94,0.12);

  --text-1: #f1f5f9;
  --text-2: rgba(241,245,249,0.65);
  --text-3: rgba(241,245,249,0.4);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--deep);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- Background --- */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1145 35%, #0d1f3c 65%, #0a0e1a 100%);
  background-size: 400% 400%;
  animation: bgShift 25s ease infinite;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.2;
  will-change: transform;
}

.bg-orb--1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.5), transparent 70%);
  top: -5%; left: -10%;
  animation: orb1 28s ease-in-out infinite;
}

.bg-orb--2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(6,182,212,0.4), transparent 70%);
  bottom: 10%; right: -8%;
  animation: orb2 32s ease-in-out infinite;
}

@keyframes bgShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes orb1 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(60px,40px) scale(1.1); }
}

@keyframes orb2 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(-50px,-30px) scale(1.08); }
}

/* --- Layout --- */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 0;
  background: rgba(8,11,22,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s;
}

.logo-link:hover { opacity: 0.8; }

.logo-img {
  height: 30px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(99,102,241,0.25));
}

.header-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9999px;
  background: var(--indigo-dim);
  border: 1px solid rgba(99,102,241,0.2);
  color: var(--indigo-light);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.2s;
}

.header-back:hover { color: var(--text-2); }

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 48px 24px 32px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  color: var(--cyan-light);
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 20px;
  animation: slideUp 0.6s var(--ease) both;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
  animation: slideUp 0.6s 0.08s var(--ease) both;
}

.hero h1 .grad {
  background: linear-gradient(135deg, #e0e7ff, #ffffff 40%, #a5f3fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: clamp(0.92rem, 1.5vw, 1.05rem);
  color: var(--text-2);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.7;
  animation: slideUp 0.6s 0.16s var(--ease) both;
}

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

/* --- Main --- */
.main-area {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 48px;
  flex: 1;
  width: 100%;
}

/* --- Input Section --- */
.input-section {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  animation: slideUp 0.6s 0.24s var(--ease) both;
}

.input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.input-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-label i {
  color: var(--indigo-light);
  font-size: 0.85rem;
}

.input-row {
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
}

.input-prefix {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-3);
  padding: 16px 0;
  flex-shrink: 0;
  user-select: none;
}

.domain-input {
  flex: 1;
  padding: 16px 8px;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  outline: none;
  min-width: 0;
}

.domain-input::placeholder {
  color: var(--text-3);
}

.btn-scan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.3s var(--ease);
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(99,102,241,0.25);
}

.btn-scan:hover {
  filter: brightness(1.1);
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
}

.btn-scan:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
}

.btn-scan i {
  font-size: 0.8rem;
}

.input-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-3);
}

.input-hint--error {
  color: var(--rose-light);
}

/* --- Loading --- */
.loading-section {
  text-align: center;
  padding: 48px 20px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--indigo-light);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 0.9rem;
  color: var(--text-2);
}

/* --- Grade Row --- */
.grade-row {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 24px;
  padding: 28px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  animation: slideUp 0.5s var(--ease) both;
}

.grade-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  background: var(--surface-2);
  border: 3px solid var(--border);
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.grade-circle--a {
  border-color: var(--emerald);
  box-shadow: 0 0 40px -10px rgba(16,185,129,0.3);
}

.grade-circle--b {
  border-color: var(--emerald);
  box-shadow: 0 0 40px -10px rgba(16,185,129,0.2);
}

.grade-circle--c {
  border-color: var(--amber);
  box-shadow: 0 0 40px -10px rgba(245,158,11,0.3);
}

.grade-circle--d {
  border-color: var(--rose);
  box-shadow: 0 0 40px -10px rgba(244,63,94,0.2);
}

.grade-circle--f {
  border-color: var(--rose);
  box-shadow: 0 0 40px -10px rgba(244,63,94,0.3);
}

.grade-letter {
  font-size: 2.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
  color: var(--text-1);
}

.grade-circle--a .grade-letter { color: var(--emerald-light); }
.grade-circle--b .grade-letter { color: var(--emerald-light); }
.grade-circle--c .grade-letter { color: var(--amber-light); }
.grade-circle--d .grade-letter { color: var(--rose-light); }
.grade-circle--f .grade-letter { color: var(--rose-light); }

.grade-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-top: 2px;
}

.grade-details {
  flex: 1;
  min-width: 0;
}

.grade-domain {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
  font-family: var(--font-mono);
  word-break: break-all;
}

.grade-summary {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 14px;
  line-height: 1.5;
}

.summary-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-bar-track {
  height: 8px;
  border-radius: 9999px;
  background: var(--surface-3);
  overflow: hidden;
}

.summary-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--indigo), var(--cyan));
  transition: width 0.6s var(--ease);
}

.summary-bar-text {
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* --- Scan Notice --- */
.scan-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--amber-dim);
  border: 1px solid rgba(245,158,11,0.2);
  color: var(--amber-light);
  font-size: 0.82rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.scan-notice i {
  font-size: 1rem;
  flex-shrink: 0;
}

/* --- Header Cards --- */
.headers-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.header-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  border-left: 4px solid var(--border);
  transition: border-color 0.3s var(--ease);
  animation: slideUp 0.4s var(--ease) both;
}

.header-card--pass {
  border-left-color: var(--emerald);
}

.header-card--warn {
  border-left-color: var(--amber);
}

.header-card--fail {
  border-left-color: var(--rose);
}

.header-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 10px;
}

.header-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.header-card--pass .header-card-icon {
  background: var(--emerald-dim);
  color: var(--emerald-light);
}

.header-card--warn .header-card-icon {
  background: var(--amber-dim);
  color: var(--amber-light);
}

.header-card--fail .header-card-icon {
  background: var(--rose-dim);
  color: var(--rose-light);
}

.header-card-info {
  flex: 1;
  min-width: 0;
}

.header-card-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.header-card-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-1);
  font-family: var(--font-mono);
}

.severity-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.severity-tag--alto {
  background: var(--rose-dim);
  color: var(--rose-light);
  border: 1px solid rgba(244,63,94,0.2);
}

.severity-tag--medio {
  background: var(--amber-dim);
  color: var(--amber-light);
  border: 1px solid rgba(245,158,11,0.2);
}

.severity-tag--baixo {
  background: var(--cyan-dim);
  color: var(--cyan-light);
  border: 1px solid rgba(6,182,212,0.2);
}

.header-card-value {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-2);
  margin-bottom: 8px;
  word-break: break-all;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.header-card-value--absent {
  color: var(--rose-light);
  font-style: italic;
}

.header-card-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 6px;
}

.header-card-rec {
  font-size: 0.78rem;
  color: var(--text-3);
  line-height: 1.5;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}

.header-card-rec strong {
  color: var(--text-2);
}

/* --- Info Card --- */
.info-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 24px;
}

.info-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--indigo-dim);
  color: var(--indigo-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.info-content h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
}

.info-content p {
  font-size: 0.84rem;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 8px;
}

.info-content p:last-child {
  margin-bottom: 0;
}

.info-content strong {
  color: var(--text-1);
}

/* --- CTA Cortex --- */
.cta-cortex {
  margin-top: 32px;
  position: relative;
}

.cta-cortex-link {
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(6,182,212,0.04));
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 16px;
  padding: 36px 32px;
  overflow: hidden;
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.cta-cortex-link:hover {
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 0 60px -20px rgba(99,102,241,0.15);
}

.cta-cortex-glow {
  position: absolute;
  top: -40%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(99,102,241,0.12), transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
  opacity: 0.5;
}

.cta-cortex-link:hover .cta-cortex-glow {
  opacity: 1;
}

.cta-cortex-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
}

.cta-cortex-logo {
  width: 72px;
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(99,102,241,0.2));
  transition: transform 0.4s var(--ease);
}

.cta-cortex-link:hover .cta-cortex-logo {
  transform: scale(1.06);
}

.cta-cortex-text {
  flex: 1;
  min-width: 0;
}

.cta-cortex-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--indigo-light);
  margin-bottom: 8px;
}

.cta-cortex-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
  line-height: 1.3;
}

.cta-cortex-desc {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 16px;
}

.cta-cortex-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(99,102,241,0.25);
  transition: all 0.3s var(--ease);
}

.cta-cortex-btn i {
  font-size: 0.7rem;
  transition: transform 0.3s var(--ease);
}

.cta-cortex-link:hover .cta-cortex-btn {
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
  filter: brightness(1.08);
}

.cta-cortex-link:hover .cta-cortex-btn i {
  transform: translateX(3px);
}

/* --- Footer --- */
.site-footer {
  margin-top: auto;
  padding: 24px;
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-3);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-link {
  font-size: 0.75rem;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover { color: var(--text-2); }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-0);
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-1);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  transition: all 0.4s var(--ease);
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-text { font-size: 0.85rem; flex: 1; min-width: 0; }

/* --- Version --- */
.version-number {
  position: fixed;
  bottom: 10px;
  left: 10px;
  color: var(--text-3);
  font-size: 0.65rem;
  z-index: 101;
  font-family: var(--font-mono);
}

/* --- Focus --- */
.btn-scan:focus-visible,
.domain-input:focus-visible,
.logo-link:focus-visible,
.header-back:focus-visible,
.footer-link:focus-visible,
.cta-cortex-link:focus-visible {
  outline: 2px solid var(--indigo-light);
  outline-offset: 2px;
  border-radius: 8px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .grade-row {
    flex-direction: column;
    text-align: center;
    gap: 20px;
    padding: 24px 20px;
  }

  .grade-circle {
    margin: 0 auto;
  }

  .summary-bar-wrap {
    align-items: center;
  }

  .hero {
    padding: 36px 20px 24px;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .input-row {
    flex-wrap: wrap;
    padding: 0 14px;
    gap: 8px;
  }

  .input-prefix {
    padding: 12px 0 0;
  }

  .domain-input {
    padding: 12px 4px;
    font-size: 0.85rem;
  }

  .btn-scan {
    width: 100%;
    justify-content: center;
    margin-bottom: 12px;
  }

  .header-card-top {
    flex-direction: column;
    gap: 10px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .cta-cortex-content {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .cta-cortex-link {
    padding: 28px 24px;
  }

  .cta-cortex-logo {
    width: 60px;
  }

  .cta-cortex-title {
    font-size: 1.05rem;
  }

  .cta-cortex-desc {
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.4rem;
  }

  .hero p {
    font-size: 0.88rem;
  }

  .grade-circle {
    width: 90px;
    height: 90px;
  }

  .grade-letter {
    font-size: 2rem;
  }

  .header-card {
    padding: 16px;
  }

  .header-card-name {
    font-size: 0.8rem;
  }

  .header-card-value {
    font-size: 0.72rem;
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Print --- */
@media print {
  .bg-scene, .toast, .version-number, .header, .loading-section, .cta-cortex { display: none; }
  body { background: white; color: black; }
  .input-section, .grade-row, .header-card, .info-card, .scan-notice {
    border: 1px solid #ccc;
    background: white;
  }
  .grade-letter, .grade-domain, .grade-summary,
  .header-card-name, .header-card-desc, .header-card-rec,
  .summary-bar-text, .info-content p, .info-content h3 {
    color: black !important;
    -webkit-text-fill-color: black !important;
  }
  .header-card--pass { border-left-color: #059669; }
  .header-card--warn { border-left-color: #d97706; }
  .header-card--fail { border-left-color: #dc2626; }
}
