/* Vital SEO — Website Broken Link & Redirect Checker */
/* Dedicated tool styling. Shared site components remain unchanged. */

.broken-link-introduction {
  max-width: 850px;
  line-height: 1.75;
}

.broken-link-results {
  margin-top: 28px;
  min-width: 0;
}

.broken-link-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.broken-link-summary > div {
  min-width: 0;
  padding: 18px 12px;
  border: 1px solid var(--border, #d8e2eb);
  background: var(--surface, #f5f8fc);
  text-align: center;
}

.broken-link-summary strong {
  display: block;
  margin-bottom: 6px;
  font-size: clamp(1.35rem, 2.5vw, 1.9rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.broken-link-summary span {
  display: block;
  font-size: 0.85rem;
  line-height: 1.45;
}

#brokenLinkProgress {
  margin: 16px 0;
  line-height: 1.65;
}

.broken-link-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 20px 0 16px;
}

.broken-link-toolbar label {
  font-weight: 600;
  font-size: 0.9rem;
}

.broken-link-toolbar select,
.broken-link-toolbar input {
  min-width: 0;
  max-width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
}

.broken-link-toolbar input {
  flex: 1 1 180px;
}

.broken-link-toolbar button {
  white-space: nowrap;
}

.broken-link-toolbar button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.broken-link-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border, #d8e2eb);
}

.broken-link-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.9rem;
}

.broken-link-table th,
.broken-link-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border, #d8e2eb);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.broken-link-table th {
  font-weight: 700;
  background: var(--surface, #f5f8fc);
}

.broken-link-table th:nth-child(1) { width: 38%; }
.broken-link-table th:nth-child(2) { width: 15%; }
.broken-link-table th:nth-child(3) { width: 32%; }
.broken-link-table th:nth-child(4) { width: 15%; }

.broken-link-table tbody tr:last-child td {
  border-bottom: 0;
}

.broken-link-table a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.broken-link-status {
  display: inline-block;
  padding: 5px 9px;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.broken-link-status--broken {
  color: #b42318;
}

.broken-link-status--redirect {
  color: #a45b00;
}

.broken-link-status--unverified {
  color: #526579;
}

.broken-link-source-details summary {
  cursor: pointer;
  font-weight: 600;
  line-height: 1.5;
}

.broken-link-source-details ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.broken-link-source-details li {
  margin: 7px 0;
  overflow-wrap: anywhere;
}

.broken-link-empty {
  padding: 18px 0;
  line-height: 1.6;
}

.broken-link-table .broken-link-destination {
  font-size: 0.87rem;
}

.broken-link-table .broken-link-note {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  line-height: 1.5;
}

html[data-theme="dark"] .broken-link-summary > div,
html[data-theme="dark"] .broken-link-table th {
  background: #192638;
  border-color: #405169;
}

html[data-theme="dark"] .broken-link-table-wrap,
html[data-theme="dark"] .broken-link-table th,
html[data-theme="dark"] .broken-link-table td {
  border-color: #405169;
}

html[data-theme="dark"] .broken-link-toolbar select,
html[data-theme="dark"] .broken-link-toolbar input {
  background: #192638;
  color: #f1f5f9;
  border-color: #526579;
}

html[data-theme="dark"] .broken-link-status--broken {
  color: #ff9991;
}

html[data-theme="dark"] .broken-link-status--redirect {
  color: #ffca78;
}

html[data-theme="dark"] .broken-link-status--unverified {
  color: #c6d5e5;
}

@media (max-width: 850px) {
  .broken-link-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .broken-link-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .broken-link-summary > div {
    padding: 14px 8px;
  }

  .broken-link-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .broken-link-toolbar select,
  .broken-link-toolbar input,
  .broken-link-toolbar button {
    width: 100%;
  }

  .broken-link-table {
    min-width: 640px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .broken-link-results *,
  .broken-link-results *::before,
  .broken-link-results *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
  }
}


/* Website checker — visualiser-aligned panels and crawl progress */

/* Recreate the full-width expandable panels used by the visualiser. */
#tool-website-broken-link-checker > details.crawl-map-instructions,
#tool-website-broken-link-checker .crawl-map-seo-tip {
  display: block;
  margin: 14px 0;
  border: 1px solid #cbdff3;
  border-radius: 5px;
  background: #f2f8ff;
  overflow: hidden;
}

#tool-website-broken-link-checker > details.crawl-map-instructions > summary,
#tool-website-broken-link-checker .crawl-map-seo-tip > summary {
  display: list-item;
  padding: 13px 15px;
  cursor: pointer;
  font-weight: 600;
  color: #183c65;
  list-style-position: inside;
}

#tool-website-broken-link-checker > details.crawl-map-instructions[open] > summary,
#tool-website-broken-link-checker .crawl-map-seo-tip[open] > summary {
  border-bottom: 1px solid #cbdff3;
}

#tool-website-broken-link-checker .crawl-map-instructions-content,
#tool-website-broken-link-checker .crawl-map-seo-tip-content {
  padding: 15px 18px;
  line-height: 1.7;
}

#tool-website-broken-link-checker .crawl-map-instructions-content li {
  margin: 8px 0;
}

/* Keep the URL input, depth selector and action button aligned. */
#tool-website-broken-link-checker .crawl-map-input-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
}

#tool-website-broken-link-checker #brokenLinkUrl {
  flex: 2 1 260px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #c7d5e5;
  border-radius: 6px;
  font: inherit;
}

#tool-website-broken-link-checker .crawl-map-depth-preview {
  flex: 0 1 190px;
  min-width: 150px;
}

#tool-website-broken-link-checker .crawl-map-depth-preview label {
  display: block;
  margin-bottom: 6px;
}

#tool-website-broken-link-checker #brokenLinkDepth {
  width: 100%;
  min-height: 43px;
  padding: 8px;
  border: 1px solid #c7d5e5;
  border-radius: 6px;
  font: inherit;
}

#tool-website-broken-link-checker .crawl-map-input-row > button {
  min-height: 43px;
}

/* Live crawl progress. */
.broken-link-crawl-panel {
  margin: 25px 0;
  padding: 20px;
  border: 1px solid #cbdff3;
  border-radius: 5px;
  background: #f2f8ff;
}

.broken-link-crawl-panel[hidden] {
  display: none !important;
}

.broken-link-crawl-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.broken-link-crawl-heading h3 {
  margin: 0;
  font-size: 1.05rem;
}

#brokenLinkCrawlState {
  font-size: 0.85rem;
  font-weight: 600;
}

.broken-link-progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 20px;
  background: #d8e5f3;
}

.broken-link-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #2b7fe4;
  transition: width 220ms ease;
}

.broken-link-crawl-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 14px 0 18px;
  font-size: 0.9rem;
}

.broken-link-crawl-metrics strong {
  font-variant-numeric: tabular-nums;
}

.broken-link-crawl-path {
  padding: 16px;
  border: 1px solid #d1e0f0;
  border-radius: 5px;
  background: #ffffff;
}

.broken-link-crawl-path h4 {
  margin: 0 0 9px;
  font-size: 0.9rem;
}

#brokenLinkCurrentUrl {
  margin: 0 0 16px;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.broken-link-recent-urls {
  max-height: 180px;
  overflow-y: auto;
  margin: 0;
  padding-left: 23px;
  font-size: 0.85rem;
}

.broken-link-recent-urls li {
  margin: 7px 0;
  overflow-wrap: anywhere;
}

.broken-link-crawl-notice {
  margin: 14px 0 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Dark mode. */
html[data-theme="dark"] #tool-website-broken-link-checker > details.crawl-map-instructions,
html[data-theme="dark"] #tool-website-broken-link-checker .crawl-map-seo-tip,
html[data-theme="dark"] .broken-link-crawl-panel {
  background: #192b41;
  border-color: #405b79;
}

html[data-theme="dark"] #tool-website-broken-link-checker > details.crawl-map-instructions > summary,
html[data-theme="dark"] #tool-website-broken-link-checker .crawl-map-seo-tip > summary {
  color: #d8eaff;
}

html[data-theme="dark"] #tool-website-broken-link-checker .crawl-map-instructions-content,
html[data-theme="dark"] #tool-website-broken-link-checker .crawl-map-seo-tip-content {
  color: #edf4fc;
}

html[data-theme="dark"] .broken-link-crawl-path {
  background: #142236;
  border-color: #405b79;
}

html[data-theme="dark"] .broken-link-progress-track {
  background: #354c67;
}

html[data-theme="dark"] #tool-website-broken-link-checker #brokenLinkUrl,
html[data-theme="dark"] #tool-website-broken-link-checker #brokenLinkDepth {
  background: #142236;
  color: #edf4fc;
  border-color: #526b87;
}

@media (max-width: 650px) {
  #tool-website-broken-link-checker .crawl-map-input-row {
    flex-direction: column;
    align-items: stretch;
  }

  #tool-website-broken-link-checker #brokenLinkUrl,
  #tool-website-broken-link-checker .crawl-map-depth-preview {
    flex: 0 0 auto;
    width: 100%;
  }

  #tool-website-broken-link-checker .crawl-map-input-row > button {
    width: 100%;
  }

  .broken-link-crawl-panel {
    padding: 15px;
  }

  .broken-link-crawl-metrics {
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .broken-link-progress-fill {
    transition: none;
  }
}


/* Website checker — colour-coded result rows */

/* Working links — soft green. */
.broken-link-table tbody tr.broken-link-row--ok > td {
  background-color: #eaf7ef;
  border-top-color: #a9ddbb;
  border-bottom-color: #a9ddbb;
}

/* Confirmed broken links — soft red. */
.broken-link-table tbody tr.broken-link-row--broken > td {
  background-color: #fdecee;
  border-top-color: #f3a6ae;
  border-bottom-color: #f3a6ae;
}

/* Redirects — soft yellow. */
.broken-link-table tbody tr.broken-link-row--redirect > td {
  background-color: #fff5dc;
  border-top-color: #eacb82;
  border-bottom-color: #eacb82;
}

/* Unverified responses — subtle neutral grey. */
.broken-link-table tbody tr.broken-link-row--unverified > td {
  background-color: #f3f5f8;
  border-top-color: #d5dce5;
  border-bottom-color: #d5dce5;
}

/* Stronger colour at the left edge of each finding. */
.broken-link-table tbody tr.broken-link-row--ok > td:first-child {
  box-shadow: inset 3px 0 #23854a;
}

.broken-link-table tbody tr.broken-link-row--broken > td:first-child {
  box-shadow: inset 3px 0 #d33243;
}

.broken-link-table tbody tr.broken-link-row--redirect > td:first-child {
  box-shadow: inset 3px 0 #c58b15;
}

.broken-link-table tbody tr.broken-link-row--unverified > td:first-child {
  box-shadow: inset 3px 0 #8291a4;
}

/* Status badges follow the same colour system. */
.broken-link-status--ok {
  color: #17633a;
}

.broken-link-status--broken {
  color: #b42332;
}

.broken-link-status--redirect {
  color: #805500;
}

/* Dark-mode equivalents. */
html[data-theme="dark"] .broken-link-table tbody tr.broken-link-row--ok > td {
  background-color: #19382a;
  border-top-color: #376d50;
  border-bottom-color: #376d50;
}

html[data-theme="dark"] .broken-link-table tbody tr.broken-link-row--broken > td {
  background-color: #42252d;
  border-top-color: #88505a;
  border-bottom-color: #88505a;
}

html[data-theme="dark"] .broken-link-table tbody tr.broken-link-row--redirect > td {
  background-color: #42351d;
  border-top-color: #806739;
  border-bottom-color: #806739;
}

html[data-theme="dark"] .broken-link-table tbody tr.broken-link-row--unverified > td {
  background-color: #263345;
  border-top-color: #45576e;
  border-bottom-color: #45576e;
}

html[data-theme="dark"] .broken-link-status--ok {
  color: #9be2b4;
}

html[data-theme="dark"] .broken-link-status--broken {
  color: #ffaaa9;
}

html[data-theme="dark"] .broken-link-status--redirect {
  color: #ffda91;
}


/* Website checker — colour-coded summary cards */

/* Activity metrics: neutral blue. */
.broken-link-summary > div:nth-child(1),
.broken-link-summary > div:nth-child(2) {
  background: #f1f7ff;
  border-color: #cbdff3;
}

/* Broken links: red. */
.broken-link-summary > div:nth-child(3) {
  background: #fdecee;
  border-color: #f3a6ae;
}

.broken-link-summary > div:nth-child(3) strong {
  color: #b42332;
}

/* Redirects: yellow. */
.broken-link-summary > div:nth-child(4) {
  background: #fff5dc;
  border-color: #eacb82;
}

.broken-link-summary > div:nth-child(4) strong {
  color: #805500;
}

/* Unverified: grey. */
.broken-link-summary > div:nth-child(5) {
  background: #f3f5f8;
  border-color: #d5dce5;
}

.broken-link-summary > div:nth-child(5) strong {
  color: #526579;
}

/* Dark-mode equivalents. */
html[data-theme="dark"] .broken-link-summary > div:nth-child(1),
html[data-theme="dark"] .broken-link-summary > div:nth-child(2) {
  background: #192b41;
  border-color: #405b79;
}

html[data-theme="dark"] .broken-link-summary > div:nth-child(3) {
  background: #42252d;
  border-color: #88505a;
}

html[data-theme="dark"] .broken-link-summary > div:nth-child(3) strong {
  color: #ffaaa9;
}

html[data-theme="dark"] .broken-link-summary > div:nth-child(4) {
  background: #42351d;
  border-color: #806739;
}

html[data-theme="dark"] .broken-link-summary > div:nth-child(4) strong {
  color: #ffda91;
}

html[data-theme="dark"] .broken-link-summary > div:nth-child(5) {
  background: #263345;
  border-color: #45576e;
}

html[data-theme="dark"] .broken-link-summary > div:nth-child(5) strong {
  color: #c6d5e5;
}
