/* --- 1. DESIGN TOKENS & RESET --- */
:root {
  --primary: #4f46e5;
  --primary-glow: #818cf8;
  --accent: #38bdf8;

  --bg-body: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.7);
  --bg-card: #ffffff;

  --text-main: #0f172a;
  --text-muted: #64748b;

  --font-h1: clamp(2.4rem, 4.5vw, 3.6rem);
  --font-h2: clamp(1.8rem, 3.5vw, 2.6rem);

  --container-width: 1200px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.08);
  --shadow-hover: 0 20px 40px -10px rgba(79, 70, 229, 0.15);
  --shadow-strong: 0 24px 60px -20px rgba(15,23,42,0.35);

  --transition: all 0.25s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;

  background-image:
    radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(56, 189, 248, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* --- 2. UTILITIES --- */

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

.fade-in-up {
  animation: fadeInUp 0.7s ease-out forwards;
  opacity: 0;
  transform: translateY(18px);
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

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

/* Flash messages */
.flash-container {
  margin-bottom: 16px;
}

.flash {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.flash-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.flash-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* --- 3. HEADER / NAV --- */

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 40;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

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

.brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
}

.nav-link:hover {
  color: var(--primary);
}

.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background: var(--primary);
  transition: width 0.2s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* --- 4. HERO SECTION --- */

.hero {
  padding-top: 120px;
  padding-bottom: 80px;
  position: relative;
}

.blob {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  z-index: -1;
}
.blob-1 {
  top: -120px;
  left: -120px;
  background: var(--primary-glow);
}
.blob-2 {
  bottom: -140px;
  right: -140px;
  background: var(--accent);
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}

@media (max-width: 900px) {
  .hero-layout {
    grid-template-columns: 1fr;
  }
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.5);
  font-size: 0.78rem;
  color: #475569;
  margin-bottom: 12px;
}

.badge-pill span + span {
  padding-left: 8px;
  border-left: 1px solid rgba(148, 163, 184, 0.7);
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: var(--font-h1);
  line-height: 1.05;
  letter-spacing: -0.05em;
  margin-bottom: 18px;
}

.hero-title-margin {
  margin-top: 8px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.02rem;
  color: var(--text-muted);
  max-width: 520px;
  margin-bottom: 18px;
}

.hero-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-meta svg {
  width: 16px;
  height: 16px;
}

/* Stats cards */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 10px 30px -18px rgba(15,23,42,0.45);
}

.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 4px;
}

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}

.stat-hint {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* --- 5. UPLOAD CARD --- */

.dashboard-preview {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.05),
    0 24px 50px -20px rgba(15, 23, 42, 0.45);
  padding: 14px;
  transform: perspective(1000px) rotateX(2deg);
  transition: transform 0.4s ease;
}

.dashboard-preview:hover {
  transform: perspective(1000px) rotateX(0deg);
}

.dashboard-frame {
  background: #f1f5f9;
  border-radius: 10px;
  min-height: 280px;
  border: 1px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px 18px 20px;
}

.upload-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 10px;
}

/* Drop zone */

#drop-zone {
  border-radius: 14px;
  border: 2px dashed #94a3b8;
  padding: 28px 16px;
  text-align: center;
  background: rgba(15, 23, 42, 0.02);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

#drop-zone strong {
  font-size: 0.98rem;
}

#drop-zone span {
  font-size: 0.9rem;
  color: #6b7280;
}

#drop-zone small {
  font-size: 0.78rem;
  color: #9ca3af;
}

#drop-zone.highlight {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

#file-input {
  display: none;
}

#status {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #4b5563;
}

#error {
  margin-top: 4px;
  font-size: 0.84rem;
  color: #b91c1c;
}

/* --- 6. RESULTS SECTION BASE --- */

.results-section,
.batch-section {
  padding: 40px 0 80px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.results-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: var(--font-h2);
}

.results-header p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.results-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Tabs */

.tabs {
  display: inline-flex;
  background: #e5e7eb;
  border-radius: 999px;
  padding: 3px;
}

.tab-btn {
  border: none;
  background: transparent;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  color: #4b5563;
  font-weight: 500;
  transition: var(--transition);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 3px 12px rgba(148, 163, 184, 0.6);
}

/* Generic card */

.card-block {
  background: #ffffff;
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 18px 40px -20px rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 18px;
}

.card-block h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

/* --- 7. BATCH TABLE --- */

.batch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.batch-table thead {
  background: #f1f5f9;
}

.batch-table th,
.batch-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.batch-table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

.batch-link {
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

.batch-link:hover {
  color: #312e81;
}

/* Risk badge */

.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.risk-medium {
  background: #fef3c7;
  border-color: #fdba74;
  color: #92400e;
}

.risk-badge .score {
  font-weight: 600;
}

/* --- 8. INSIGHTS --- */

.insights-block {
  border-radius: 12px;
  padding: 10px 12px 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 0.9rem;
}

.insights-risk-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.insights-level {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.insights-level-low {
  background: #ecfdf3;
  color: #15803d;
}

.insights-level-medium {
  background: #fef3c7;
  color: #b45309;
}

.insights-level-high {
  background: #fef2f2;
  color: #b91c1c;
}

.insights-score {
  font-size: 0.8rem;
  color: #4b5563;
}

.insights-auth-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 8px;
}

.insights-auth-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: #4b5563;
}

.auth-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.auth-chip {
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.auth-chip.pass {
  background: #ecfdf3;
  color: #15803d;
  border-color: #bbf7d0;
}

.auth-chip.fail {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.auth-chip.missing {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

/* Links indicators */

.insights-links-block {
  margin-top: 6px;
  margin-bottom: 8px;
}

.indicators-intro {
  font-size: 0.83rem;
  color: #4b5563;
  margin-bottom: 6px;
}

.indicators-none {
  font-size: 0.83rem;
  color: #6b7280;
}

.indicator-pill {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 10px;
  padding: 6px 8px;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.indicator-pill.good {
  background: #f1f5f9;
  color: #0f172a;
}

.indicator-pill.short {
  background: #eff6ff;
  color: #1d4ed8;
}

.indicator-pill.bad {
  background: #fef2f2;
  color: #b91c1c;
}

.indicator-url {
  font-size: 0.78rem;
  color: #6b7280;
  word-break: break-word;
}

/* Reasons */

.insights-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.insight-pill {
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #111827;
}

.insights-empty {
  font-size: 0.83rem;
  color: #6b7280;
  margin-top: 4px;
}

/* --- 9. EMAIL OVERVIEW & HEADERS --- */

.header-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.header-summary-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 4px;
}

.header-summary-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
}

/* Email body */

.email-body {
  font-size: 0.9rem;
}

#html-preview {
  background: #f9fafb;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid #e5e7eb;
}

#preview-body-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  background: #0f172a;
  color: #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  white-space: pre-wrap;
}

/* Raw headers grid */

.headers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  font-size: 0.86rem;
}

.headers-grid-margin {
  margin-top: 8px;
}

/* Header box: prevent "X-Sent-To" bleeding */
.header-box {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 4px;

  word-break: break-word;
  overflow-wrap: anywhere;
}

.header-box strong {
  font-size: 0.8rem;
  color: #4b5563;
}

.header-box span {
  font-size: 0.86rem;
  color: #0f172a;
}

@media (max-width: 768px) {
  .headers-grid {
    grid-template-columns: 1fr;
  }
}

/* --- 10. ATTACHMENTS & HASHES --- */

.attachments-list {
  font-size: 0.88rem;
}

.attachments-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.attachments-count {
  font-size: 0.85rem;
  color: #4b5563;
}

.attachments-list ul {
  list-style: none;
}

.attachments-list li {
  margin-bottom: 8px;
}

.attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.attachment-pill .ext {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.attachment-name {
  font-weight: 500;
}

.attachment-meta {
  font-size: 0.78rem;
  color: #6b7280;
}

/* Risk coloring for attachments */
.badge-low {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.badge-medium {
  background: #fef3c7;
  border-color: #fed7aa;
  color: #b45309;
}

.badge-high {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.attachment-meta-row {
  margin-top: 2px;
  font-size: 0.8rem;
  color: #6b7280;
}

.attachment-meta-row a {
  text-decoration: underline;
}

/* Single download icon – circular & bigger */
.attachment-download-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  text-decoration: none;
  color: var(--primary);
  background: #f8fafc;
  flex-shrink: 0;
  transition: var(--transition);
}

.attachment-download-icon:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.attachment-download-icon svg {
  width: 18px;
  height: 18px;
}

/* Download all button at bottom */

.attachments-download-all-row {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.attachments-download-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  background: #f8fafc;
  transition: var(--transition);
}

.attachments-download-all:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
}

.download-all-icon-circle {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 70, 229, 0.08);
  font-size: 0.8rem;
}

/* Hashes block */

.attachments-hashes {
  margin-top: 14px;
  border-top: 1px dashed #e5e7eb;
  padding-top: 10px;
}

.hashes-heading {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.hash-attachment {
  margin-bottom: 8px;
}

.hash-attachment-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
}

.hash-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 4px;
  font-size: 0.8rem;
}

.hash-label {
  color: #6b7280;
  font-weight: 500;
}

.hash-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  word-break: break-all;
  color: #111827;
}

/* Muted text */

.muted-text {
  font-size: 0.85rem;
  color: #6b7280;
}

/* --- 11. RAW CODE / PRISM CONTAINER --- */

.code-container {
  background: #020617;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid #1f2937;
  max-height: 500px;
  overflow: auto;
}

/* --- 12. FOOTER --- */

footer {
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 18px 0 26px;
  font-size: 0.86rem;
  color: #6b7280;
  text-align: center;
}

/* --- 13. RESPONSIVE --- */

@media (max-width: 600px) {
  nav {
    height: 64px;
  }

  .hero {
    padding-top: 110px;
  }

  .card-block {
    padding: 14px 14px 12px;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }
}