/* Dashboard-specific styles. Extends forms.css. */

/* ---- Split-panel layout (matches /dashboard/login) ---- */

.audit-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  min-height: 100vh;
  width: 100%;
}

.audit-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #111;
  color: #fff;
  padding: 48px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.audit-brand-logo img {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.audit-brand-copy {
  margin-top: auto;
}

.audit-brand-copy h2 {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 12px;
  max-width: 360px;
}

.audit-brand-copy p {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  max-width: 320px;
  line-height: 1.5;
}

.audit-brand-foot {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 48px;
}

.audit-form-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  min-height: 100vh;
}

.audit-mobile-logo {
  display: none;
}

.audit-mobile-logo img {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.audit-form-wrap {
  width: 100%;
  max-width: 480px;
}

.audit-form-wrap h1 {
  font-size: 30px;
  font-weight: 800;
  color: #111;
  margin: 0 0 8px;
  line-height: 1.2;
}

.audit-form-wrap > p {
  color: var(--secondary);
  font-size: 15px;
  margin: 0 0 32px;
  line-height: 1.5;
}

.audit-form-wrap label {
  display: block;
  margin-bottom: 20px;
}

.audit-form-wrap label > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #111;
  margin-bottom: 6px;
}

.audit-form-wrap input[type="text"],
.audit-form-wrap input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #E4E8ED;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  color: var(--primary);
  background: #fff;
}

.audit-form-wrap input:focus-visible {
  outline: none;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.1);
}

.audit-form-wrap .actions {
  margin-top: 24px;
}

.audit-form-wrap button.primary {
  width: 100%;
  padding: 14px 0;
  border: none;
  border-radius: 9999px;
  background: #111;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.audit-form-wrap button.primary:hover {
  background: #222;
}

.audit-form-wrap button.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.audit-form-wrap .form-note {
  text-align: center;
  font-size: 14px;
  color: var(--secondary);
  margin-top: 16px;
}

.audit-form-wrap .form-note a {
  color: #111;
  font-weight: 600;
  text-decoration: none;
}

.audit-form-wrap .form-error {
  background: #FEF2F2;
  color: #991B1B;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin: 0 0 16px;
}

@media (max-width: 768px) {
  .audit-layout {
    display: flex;
    flex-direction: column;
  }
  .audit-brand { display: none; }
  .audit-mobile-logo {
    display: block;
    align-self: flex-start;
    margin-bottom: 40px;
  }
  .audit-form-panel {
    align-items: stretch;
    justify-content: flex-start;
    padding: 24px 20px 80px;
    min-height: 100vh;
  }
  .audit-form-wrap { max-width: none; }
}

/* ---- Results layout: full-width dashboard ---- */

.audit-layout.results-view {
  display: block;
}
.audit-layout.results-view .audit-brand { display: none; }
.audit-layout.results-view .audit-form-panel {
  max-width: 1140px;
  margin: 0 auto;
  padding: 48px 32px 80px;
  min-height: auto;
  align-items: stretch;
}

.audit-layout.results-view .audit-form-wrap {
  max-width: none;
  width: 100%;
}

@media (max-width: 768px) {
  .audit-layout.results-view .audit-form-panel {
    padding: 24px 20px 80px;
  }
}

/* ---- Brand header (site logo + name) ---- */

.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #E0E4EA;
}

.brand-header-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background: #F3F4F6;
}

.brand-header-logo--favicon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.brand-header-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-primary, var(--primary));
}

/* ---- Site screenshot ---- */

.brand-screenshot {
  margin: 0 0 32px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #E0E4EA;
  max-height: 280px;
}

.brand-screenshot img {
  width: 100%;
  display: block;
  object-fit: cover;
  object-position: top;
}

/* ---- Branded theming overrides ---- */

.audit-layout.branded .audit-form-panel {
  background: var(--brand-bg, #fff);
}

.audit-layout.branded h1 {
  color: var(--brand-primary, var(--primary));
  font-family: var(--brand-heading-font, inherit);
}

.audit-layout.branded .summary-line {
  color: var(--brand-text, var(--text));
}

.audit-layout.branded .status-group-heading {
  color: var(--brand-primary, var(--secondary));
}

.audit-layout.branded .summary-stat {
  border-color: color-mix(in srgb, var(--brand-primary, #E0E4EA) 20%, transparent);
  border-top: 3px solid var(--brand-primary, #E0E4EA);
}


.audit-layout.branded .upsell {
  border-color: color-mix(in srgb, var(--brand-primary, #E0E4EA) 30%, transparent);
}

.audit-layout.branded .upsell h2 {
  color: var(--brand-primary, var(--primary));
}

.audit-layout.branded .upsell .primary {
  background: var(--brand-primary, var(--primary));
}

/* ---- Summary strip ---- */


.results-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0 32px;
}

.summary-stat {
  background: #F9FAFB;
  border: 1px solid #E0E4EA;
  border-radius: 10px;
  padding: 20px 24px;
  text-align: center;
}

.summary-stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.summary-stat-value--red { color: #DC2626; }
.summary-stat-value--yellow { color: #F59E0B; }
.summary-stat-value--green { color: #10B981; }

.summary-stat-label {
  font-size: 13px;
  color: var(--secondary, #6B7280);
  font-weight: 500;
}

@media (max-width: 480px) {
  .results-summary-strip { grid-template-columns: 1fr; }
}

/* ---- Card grid ---- */

.results-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .results-card-grid { grid-template-columns: 1fr; }
}

.results-card-grid .analysis-card { margin: 0; }

/* ---- Status group headings ---- */

.status-group-heading {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary, #6B7280);
  margin: 0;
  padding-top: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
}

.status-group-heading:first-child { padding-top: 0; }

.status-group-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #E0E4EA;
}

/* ---- Scorecard / results ---- */

.scorecard {
  border: 1px solid #E0E4EA;
  border-radius: 8px;
  overflow: hidden;
  margin: 24px 0 32px;
}

.score-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-bottom: 1px solid #E0E4EA;
  font-size: 14px;
}

.score-row:last-child {
  border-bottom: none;
}

.score-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 5px;
  background: #D1D5DB;
}

.score-dot.red { background: #DC2626; }
.score-dot.yellow { background: #F59E0B; }
.score-dot.green { background: #10B981; }
.score-dot.unknown { background: #D1D5DB; }
.score-key {
  font-weight: 500;
  color: var(--primary);
  margin: 0 0 2px;
}

.score-note {
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}

.summary-line {
  color: var(--text);
  font-size: 14px;
  margin: 0 0 16px;
}

.upsell {
  border: 1px solid #101B2D;
  border-radius: 8px;
  padding: 24px;
  background: #F7F9FC;
  margin-top: 24px;
}

.upsell h2 {
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--primary);
}

.upsell p {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
}

.upsell-checks {
  margin: 0 0 20px;
  padding: 0 0 0 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.8;
  columns: 2;
  column-gap: 24px;
}

@media (max-width: 480px) {
  .upsell-checks { columns: 1; }
}

.score-label {
  color: var(--secondary);
  font-size: 13px;
}

.progress {
  color: var(--text);
  font-size: 15px;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: #E0E4EA;
  border-radius: 3px;
  overflow: hidden;
  margin: 24px 0 12px;
}

.progress-bar {
  height: 100%;
  background: var(--primary, #101B2D);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.progress-label {
  color: var(--text);
  font-size: 14px;
  margin: 0;
}

.insight-note {
  margin: 6px 0 0;
  padding: 10px 12px;
  background: #F7F9FC;
  border-radius: 6px;
  color: var(--primary);
  font-size: 13px;
  line-height: 1.5;
  grid-column: 2 / span 2;
}

.recommendations {
  border: 1px solid #E0E4EA;
  border-radius: 8px;
  padding: 20px;
  margin: 0 0 24px;
  background: #FFF;
}

.recommendations h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

/* ---- Analysis cards (free-tier rich results) ---- */

.analysis-card {
  border: 1px solid #E0E4EA;
  border-radius: 10px;
  padding: 24px;
  margin: 0 0 20px;
  background: #FFF;
}

.analysis-card--red { border-left: 4px solid #DC2626; }
.analysis-card--yellow { border-left: 4px solid #F59E0B; }
.analysis-card--green { border-left: 4px solid #10B981; }
.analysis-card--unknown { border-left: 4px solid #D1D5DB; }

.analysis-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.analysis-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  flex: 1;
}

.analysis-verdict {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.analysis-card--red .analysis-verdict { background: #FEE2E2; color: #991B1B; }
.analysis-card--yellow .analysis-verdict { background: #FEF3C7; color: #92400E; }
.analysis-card--green .analysis-verdict { background: #D1FAE5; color: #065F46; }
.analysis-card--unknown .analysis-verdict { background: #F3F4F6; color: #6B7280; }

.analysis-body { font-size: 14px; line-height: 1.6; }

.analysis-score-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.score-badge {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #FFF;
}

.score-badge--red { background: #DC2626; }
.score-badge--yellow { background: #F59E0B; }
.score-badge--green { background: #10B981; }

.analysis-text {
  color: var(--text, #4B5563);
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.6;
}

.analysis-text:last-child { margin-bottom: 0; }

.analysis-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #F3F4F6;
}

.analysis-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--secondary, #6B7280);
  margin: 0 0 8px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

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

.metric-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  background: #F9FAFB;
  border-radius: 6px;
  font-size: 13px;
}

.metric-label {
  flex: 1;
  color: var(--text, #4B5563);
}

.metric-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.metric-value--good { color: #059669; }
.metric-value--warn { color: #D97706; }
.metric-value--bad { color: #DC2626; }

.metric-benchmark {
  color: var(--secondary, #9CA3AF);
  font-size: 12px;
}

.pixel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pixel-found, .pixel-missing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.pixel-found {
  background: #D1FAE5;
  color: #065F46;
}

.pixel-found::before { content: '\2713 '; }

.pixel-missing {
  background: #FEE2E2;
  color: #991B1B;
}

.pixel-missing::before { content: '\2717 '; }

.pixel-id {
  font-weight: 400;
  opacity: 0.7;
  font-size: 12px;
}

/* Admin styles */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #E0E4EA;
  white-space: nowrap;
}

.admin-table th {
  font-weight: 600;
  color: var(--secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-table a {
  color: var(--primary);
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.badge--free { background: #E0E4EA; color: var(--primary); }
.badge--paid { background: #101B2D; color: #FFF; }
.badge--pending { background: #FEF3C7; color: #92400E; }
.badge--extracting { background: #DBEAFE; color: #1E40AF; }
.badge--scored { background: #D1FAE5; color: #065F46; }
.badge--insights_published { background: #101B2D; color: #FFF; }
.badge--failed { background: #FEE2E2; color: #991B1B; }

.insight-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #E0E4EA;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  color: var(--primary);
  margin-top: 8px;
  resize: vertical;
  min-height: 60px;
}

.insight-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 27, 45, 0.15);
}

.save-status {
  display: block;
  font-size: 12px;
  color: var(--secondary);
  min-height: 18px;
  margin-top: 4px;
}

/* ---- Email-the-PDF capture ---- */

.pdf-email-form {
  width: 100%;
  margin-top: 16px;
}

.pdf-email-prompt {
  font-size: 13px;
  color: var(--text, #4B5563);
  margin: 0 0 10px;
  text-align: center;
}

.pdf-email-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 5px 5px 20px;
  background: #fff;
  border: 1px solid #D1D5DB;
  border-radius: 9999px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pdf-email-row:focus-within {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.1);
}

.pdf-email-row input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--primary, #101B2D);
}

.pdf-email-row input[type="email"]:focus,
.pdf-email-row input[type="email"]:focus-visible {
  outline: none;
}

.pdf-email-send {
  flex-shrink: 0;
  padding: 10px 20px;
  border: none;
  border-radius: 9999px;
  background: #111;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.pdf-email-send:hover { background: #222; }
.pdf-email-send:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 520px) {
  .pdf-email-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
    border-radius: 24px;
  }
  .pdf-email-row input[type="email"] {
    padding: 10px 14px;
  }
  .pdf-email-send {
    width: 100%;
    padding: 12px 20px;
  }
}

.pdf-sent {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text, #4B5563);
  margin-top: 16px;
}

.pdf-sent strong {
  color: var(--primary, #101B2D);
}

/* ---- Print / PDF styles ---- */

@media print {
  @page {
    size: A4;
    margin: 16mm 14mm 20mm;
  }

  body {
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .audit-brand,
  .audit-mobile-logo,
  .upsell,
  .pdf-actions,
  .pdf-sent,
  .progress-bar-wrap,
  .progress-label {
    display: none !important;
  }

  .audit-layout,
  .audit-layout.results-view {
    display: block !important;
  }

  .audit-form-panel,
  .audit-layout.results-view .audit-form-panel {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: auto !important;
  }

  .audit-form-wrap,
  .audit-layout.results-view .audit-form-wrap {
    max-width: none !important;
  }

  .audit-form-wrap h1 {
    font-size: 22px;
    margin-bottom: 4px;
  }

  .brand-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
  }

  .brand-screenshot {
    max-height: 180px;
    margin-bottom: 16px;
  }

  .results-summary-strip {
    margin: 12px 0 16px;
    gap: 8px;
  }

  .summary-stat {
    padding: 12px 16px;
  }

  .summary-stat-value {
    font-size: 24px;
  }

  .results-card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .analysis-card {
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #ccc;
  }

  .analysis-card--red { border-left: 4px solid #DC2626; }
  .analysis-card--yellow { border-left: 4px solid #F59E0B; }
  .analysis-card--green { border-left: 4px solid #10B981; }

  .score-badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .pixel-found, .pixel-missing {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .analysis-verdict {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .metric-row {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .audit-form-wrap::after {
    content: 'Generated by Arctis Labs — arctislabs.com';
    display: block;
    text-align: center;
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid #E0E4EA;
  }
}
