/* ── VALIDATOR SIMPLIFIED LAYOUT ── */

/* Override the 2-column grid from style.css — validator has no sidebar */
.validator-main {
  display: flex !important;
  grid-template-columns: none !important;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 61px);
  padding: 0;
  background: var(--bg);
}

/* ── UPLOAD SCREEN ── */
.upload-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  max-width: 680px;
  padding: 40px 24px;
  gap: 20px;
  margin: 0 auto;
}

.validator-intro {
  width: 100%;
  max-width: 620px;
  text-align: center;
}

.validator-eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.validator-intro h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 800;
  letter-spacing: -1.2px;
  line-height: 1.12;
}

.validator-intro p {
  max-width: 580px;
  margin: 12px auto 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.validator-intro code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9em;
}

.validator-proof {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.validator-proof span {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-badges);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

/* ── ENVIRONMENT SELECTOR (pill toggle) ── */
.env-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.env-label {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.env-pills {
  display: flex;
  gap: 0;
  background: var(--color-canvas);
  border-radius: var(--radius-buttons);
  padding: 3px;
  border: 1px solid var(--border);
}

.env-pill {
  padding: 8px 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: calc(var(--radius-buttons) - 4px);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.env-pill:hover:not(.active) {
  color: var(--text);
}

.env-pill.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* ── DROP ZONE ── */
#drop-zone {
  width: 100%;
  border: 2px dashed var(--border);
  border-radius: var(--radius-cards);
  padding: 64px 32px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

#drop-zone:hover {
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

#drop-zone.dragover {
  border-color: var(--color-ink);
  background: var(--color-surface-alt);
  transform: scale(1.01);
}

.drop-icon {
  margin-bottom: 12px;
  color: var(--text-muted);
}

.drop-icon svg {
  width: 40px;
  height: 40px;
  stroke-width: 1.5;
}

.upload-text {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}

.upload-sub {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--mono);
  line-height: 1.7;
  margin-bottom: 20px;
}

.upload-btn, .upload-btn-primary {
  background: var(--color-ink, #1a1916);
  color: #ffffff !important;
  border: 1.5px solid var(--color-ink, #1a1916);
  border-radius: 9999px;
  padding: 11px 24px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.upload-btn:hover, .upload-btn-primary:hover {
  background: #000000;
  border-color: #000000;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.upload-btn-secondary {
  background: #ffffff !important;
  color: var(--color-ink, #1a1916) !important;
  border: 1.5px solid #d5d3ce !important;
  border-radius: 9999px !important;
  padding: 11px 24px !important;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: none !important;
}

.upload-btn-secondary:hover {
  background: #f8f8f6 !important;
  border-color: #aaa8a2 !important;
  color: #000000 !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

#file-input {
  display: none;
}

/* ── PROGRESS SCREEN ── */
.progress-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  max-width: 480px;
  padding: 40px 24px;
  gap: 16px;
  margin: 0 auto;
}

.progress-title {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--color-canvas);
  border-radius: calc(var(--radius-buttons) - 4px);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-ink), #e57373);
  border-radius: calc(var(--radius-buttons) - 4px);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.3) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-label {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
}

/* ── RESULTS SCREEN ── */
.results-screen {
  width: 100%;
  max-width: 800px;
  padding: 32px 24px 64px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── RESULTS SUMMARY BAR ── */
.results-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  flex-wrap: wrap;
}

.summary-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
}

.summary-stat svg {
  width: 18px;
  height: 18px;
}

.summary-stat.errors { color: #c62828; }
.summary-stat.warnings { color: #ef6c00; }
.summary-stat.passed { color: #2e7d32; }
.summary-stat.files { color: var(--text-muted); }

.summary-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.summary-env {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--color-canvas);
  padding: 4px 10px;
  border-radius: 6px;
}

/* ── ACTION BUTTONS ── */
.results-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-buttons);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1.5px solid var(--border);
}

.action-btn svg {
  width: 14px;
  height: 14px;
}

.action-btn.secondary {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.action-btn.secondary:hover {
  background: #2a2824;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.action-btn.ghost {
  background: transparent;
  color: var(--text-muted);
}

.action-btn.ghost:hover {
  background: var(--color-canvas);
  color: var(--text);
  border-color: var(--text-muted);
}

/* ── BANNER REPORT CARD (one per file) ── */
.banner-report {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}

.banner-report:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* Report header with file info + status badge */
.report-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #fafaf7;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.report-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.report-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-buttons);
  background: var(--color-canvas);
  flex-shrink: 0;
}

.report-file-icon svg {
  width: 18px;
  height: 18px;
  color: var(--text);
}

.report-file-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.report-file-name {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-file-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.report-file-meta .iab-tag {
  color: var(--color-ink);
  font-weight: 600;
}

/* Status badge on header */
.report-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: calc(var(--radius-buttons) - 4px);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}

.report-status-badge svg {
  width: 14px;
  height: 14px;
}

.report-status-badge.pass {
  background: #e8f5e9;
  color: #2e7d32;
}

.report-status-badge.warn {
  background: #fff3e0;
  color: #ef6c00;
}

.report-status-badge.fail {
  background: #ffeaea;
  color: #c62828;
}

/* Report body with checks */
.report-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Toggle arrow */
.report-toggle-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.banner-report.collapsed .report-body {
  display: none;
}

.banner-report.collapsed .report-toggle-arrow {
  transform: rotate(-90deg);
}

/* ── CHECK ITEMS (simplified single-line) ── */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-buttons);
  font-size: 13px;
  line-height: 1.5;
  transition: background 0.15s;
}

.check-item:hover {
  background: #fafaf7;
}

.check-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 1px;
}

.check-item-icon svg {
  width: 14px;
  height: 14px;
}

.check-item.error .check-item-icon { background: #ffeaea; color: #c62828; }
.check-item.warning .check-item-icon { background: #fff3e0; color: #ef6c00; }
.check-item.pass .check-item-icon { background: #e8f5e9; color: #2e7d32; }

.check-item-content {
  flex: 1;
  min-width: 0;
}

.check-item-title {
  font-weight: 700;
  font-family: var(--sans);
  margin-bottom: 2px;
}

.check-item.error .check-item-title { color: #c62828; }
.check-item.warning .check-item-title { color: #ef6c00; }
.check-item.pass .check-item-title { color: #2e7d32; }

.check-item-desc {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.check-item-fix {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--color-canvas);
  padding: 10px 14px;
  border-radius: calc(var(--radius-buttons) - 4px);
  color: var(--text);
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  border-left: 3px solid var(--color-ink);
  line-height: 1.5;
}

/* Separator between errors/warnings and passed */
.checks-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Passed checks collapsible trigger */
.passed-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  color: #2e7d32;
  cursor: pointer;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-buttons) - 4px);
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}

.passed-toggle:hover {
  background: #e8f5e9;
}

.passed-toggle svg {
  width: 14px;
  height: 14px;
}

.passed-toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s;
  margin-left: auto;
}

.passed-checks-body {
  display: none;
}

.passed-checks-body.open {
  display: flex;
  flex-direction: column;
}

.passed-checks-body.open .passed-toggle-arrow {
  transform: rotate(180deg);
}

/* ── PREVIEW SECTION (inside report body) ── */
.inline-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fafaf7;
  border-radius: var(--radius-buttons);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.inline-preview iframe,
.inline-preview canvas,
.inline-preview img {
  display: block;
  max-width: 100%;
  height: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border-radius: 2px;
}

.inline-preview iframe {
  border: none;
  background: transparent;
}

/* Preview controls bar */
.preview-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fafaf7;
  border-radius: var(--radius-buttons);
  border: 1px solid var(--border);
}

.preview-ctrl-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preview-ctrl-btn:hover {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.preview-ctrl-btn svg {
  width: 12px;
  height: 12px;
}

/* Background selector dots inline */
.bg-selector-inline {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.bg-dot {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, border-color 0.1s;
}

.bg-dot:hover {
  transform: scale(1.15);
  border-color: var(--text-muted);
}

.bg-dot.active {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.bg-dot-white { background: #ffffff; }
.bg-dot-black { background: #1a1916; }
.bg-dot-grey { background: #8a8880; }
.bg-dot-chess {
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), 
                    linear-gradient(-45deg, #ccc 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #ccc 75%), 
                    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  background-color: #fff;
}

/* Preview background modes */
.inline-preview.bg-chess {
  background-image: linear-gradient(45deg, #e2e0d8 25%, transparent 25%), 
                    linear-gradient(-45deg, #e2e0d8 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #e2e0d8 75%), 
                    linear-gradient(-45deg, transparent 75%, #e2e0d8 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #fafaf7;
}
.inline-preview.bg-white { background: #ffffff; }
.inline-preview.bg-black { background: #1a1916; }
.inline-preview.bg-grey { background: #8a8880; }

/* ── FILE TREE (collapsible inside report) ── */
.file-tree-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-buttons);
  overflow: hidden;
}

.file-tree-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: none;
  background: #fafaf7;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.file-tree-trigger:hover {
  background: #f5f2ea;
}

.file-tree-trigger svg {
  width: 14px;
  height: 14px;
}

.file-tree-trigger-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-tree-arrow {
  font-size: 10px;
  transition: transform 0.2s;
  color: var(--text-muted);
}

.file-tree-body {
  display: none;
  overflow-x: auto;
  border-top: 1px solid var(--border);
}

.file-tree-section.open .file-tree-body {
  display: block;
}

.file-tree-section.open .file-tree-arrow {
  transform: rotate(180deg);
}

.file-tree-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 11px;
  text-align: left;
}

.file-tree-table th,
.file-tree-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.file-tree-table th {
  background: #fafaf7;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.file-tree-table tbody tr:hover {
  background: #fafaf7;
}

.file-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.file-status-ok { background: #e8f5e9; color: #2e7d32; }
.file-status-warn { background: #ffeaea; color: #c62828; }

/* ── CLICK INTERCEPT ALERT (inline in report) ── */
.click-intercept-alert {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius-buttons);
  padding: 14px;
  display: none;
  flex-direction: column;
  gap: 6px;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.click-intercept-alert.visible {
  display: flex;
}

.click-alert-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #b78103;
  font-weight: 800;
  font-size: 12px;
}

.click-alert-badge svg {
  width: 14px;
  height: 14px;
}

.click-url-box {
  font-family: var(--mono);
  font-size: 11px;
  background: #fff3e0;
  border: 1px dashed #ffb74d;
  padding: 8px 12px;
  border-radius: 6px;
  color: #e65100;
  word-break: break-all;
  white-space: pre-wrap;
}

/* ── SEO SECTION ── */
.seo-section .accordion {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.specs-sources {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.6;
}

.specs-sources a {
  color: var(--text);
  text-underline-offset: 2px;
}

/* ── MOBILE NOTICE ── */
.mobile-notice {
  display: none;
}

/* ── MOBILE RESPONSIVENESS ── */
@media (max-width: 900px) {
  .upload-screen {
    padding: 24px 16px;
  }

  .results-screen {
    padding: 20px 16px 48px;
  }

  .env-selector {
    flex-direction: column;
    gap: 8px;
  }

  .mobile-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fffbef;
    border: 1px solid #ffe58f;
    padding: 10px 16px;
    border-radius: calc(var(--radius-buttons) - 4px);
    color: #d46b08;
    font-size: 13px;
    font-family: var(--sans);
    width: 100%;
    text-align: center;
  }

  .mobile-notice svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  .report-file-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .summary-divider {
    display: none;
  }

  .summary-env {
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  .upload-screen {
    max-width: 100%;
    padding: 20px 16px 32px;
  }

  .validator-intro h1 {
    font-size: 26px;
    letter-spacing: -0.7px;
  }

  .validator-intro p {
    font-size: 13px;
  }

  .env-selector,
  .env-pills {
    width: 100%;
  }

  .env-pills {
    justify-content: stretch;
  }

  .env-pill {
    min-width: 0;
    padding: 8px 9px;
    flex: 1 1 0;
    font-size: 12px;
  }

  #drop-zone {
    padding: 40px 20px;
  }

  #drop-zone .upload-btn {
    width: 100%;
    padding-inline: 18px;
  }

  .results-actions .action-btn {
    justify-content: center;
    width: 100%;
  }

  .report-body,
  .report-file-header {
    padding: 14px;
  }
}
