/* ==========================================================================
   ACB Large Print Web App -- Form & Layout Supplement
   Extends acb-large-print.css with UI-specific styles.
   ========================================================================== */

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.5em 1em;
  background: #1a1a1a;
  color: #ffffff;
}

.skip-link:focus {
  left: 0;
}

/* --- Tab Navigation Bar --- */
nav[aria-label="Main navigation"] {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0;
  border-bottom: 2px solid #1a1a1a;
  padding-bottom: 0;
  margin-bottom: 2rem;
}

.nav-brand {
  font-size: 1.333rem;
  font-weight: 700;
  text-decoration: none;
  color: #1a1a1a;
  padding: 0.5rem 0;
  margin-right: auto;
  flex-shrink: 0;
}

.nav-brand:hover,
.nav-brand:focus {
  text-decoration: underline;
}

.nav-brand[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.nav-tabs {
  display: flex;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.nav-tabs a {
  display: flex;
  align-items: center;
  white-space: nowrap;
  padding: 0.625rem 1rem;
  text-decoration: none;
  color: #444;
  font-weight: 400;
  font-size: 1rem;
  border-bottom: 3px solid transparent;
  min-height: 44px;
  min-width: 44px;
  margin-bottom: -2px;
  position: relative;
}

.nav-tabs a[aria-selected="true"] {
  color: #0055cc;
  font-weight: 700;
  border-bottom-color: #0055cc;
}

.nav-tabs a[aria-selected="false"]:hover {
  color: #003d99;
  border-bottom-color: #b3d4fc;
}

.nav-tabs a:focus {
  outline: 3px solid #0055cc;
  outline-offset: -2px;
  z-index: 1;
}

/* --- Loading State (SPA tab switch) --- */
main[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* --- Cards (landing page) --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  border: 2px solid #1a1a1a;
  padding: 1.25rem;
  border-radius: 0.25rem;
  position: relative;
}

.card h3 {
  margin-top: 0;
  font-size: 1.333rem;
}

.card p {
  margin-bottom: 0;
}

.card-formats {
  margin-top: 0.75rem !important;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  padding-left: 0;
}

/* -- Card accent borders (left stripe by operation type) -- */
.card-audit  { border-left: 5px solid #0055cc; }
.card-fix    { border-left: 5px solid #2e6b2e; }
.card-template { border-left: 5px solid #6b3fa0; }
.card-export { border-left: 5px solid #b8860b; }
.card-convert { border-left: 5px solid #8b5cf6; }

/* --- Format Pills (hero section showing supported formats) --- */
.format-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
  list-style: none;
  padding-left: 0;
}

.format-pill {
  display: inline-block;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.5em 1em;
  border-radius: 2rem;
  border: 2px solid;
}

.format-pill.format-docx {
  background: #e8f0fe;
  color: #1a3d6f;
  border-color: #2b579a;
}

.format-pill.format-xlsx {
  background: #e8f5e9;
  color: #1b5e20;
  border-color: #217346;
}

.format-pill.format-pptx {
  background: #fce4ec;
  color: #7f1d1d;
  border-color: #b7472a;
}

.format-pill.format-md {
  background: #f3e8ff;
  color: #4c1d95;
  border-color: #6b3fa0;
}

.format-pill.format-pdf {
  background: #fff3e0;
  color: #7c2d12;
  border-color: #c75000;
}

.format-pill.format-epub {
  background: #e0f2f1;
  color: #004d40;
  border-color: #00796b;
}

/* --- Format Tags (compact labels inside cards, rule lists, etc.) --- */
.format-tag {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.1em 0.45em;
  border-radius: 0.25rem;
  vertical-align: middle;
  margin-left: 0.25em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.format-tag.format-docx {
  background: #2b579a;
  color: #ffffff;
}

.format-tag.format-xlsx {
  background: #217346;
  color: #ffffff;
}

.format-tag.format-pptx {
  background: #b7472a;
  color: #ffffff;
}

.format-tag.format-md {
  background: #6b3fa0;
  color: #ffffff;
}

.format-tag.format-pdf {
  background: #c75000;
  color: #ffffff;
}

.format-tag.format-epub {
  background: #00796b;
  color: #ffffff;
}

.format-tag.format-misc {
  background: #555555;
  color: #ffffff;
}

/* --- Brand icon in nav --- */
.brand-icon {
  font-size: 1.5rem;
  vertical-align: -0.15em;
  margin-right: 0.25em;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="file"] {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 1.125rem;
  padding: 0.5em 0.75em;
  border: 2px solid #1a1a1a;
  border-radius: 0.25rem;
  width: 100%;
  max-width: 40rem;
  background: #ffffff;
}

input[type="file"] {
  padding: 0.75em;
}

input[type="text"]:focus,
input[type="file"]:focus {
  outline: 3px solid #0055cc;
  outline-offset: 2px;
}

.help-text {
  font-size: 1rem;
  color: #444;
  margin-top: 0.25rem;
  margin-bottom: 0;
}

/* --- Radio & Checkbox Groups --- */
fieldset {
  border: 2px solid #767676;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0.25rem;
}

legend {
  font-weight: 700;
  font-size: 1.125rem;
  padding: 0 0.5em;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-group label,
.checkbox-group label,
fieldset > label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}

input[type="radio"],
input[type="checkbox"] {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.2em;
  accent-color: #0055cc;
}

/* --- Custom Rules Panel --- */
.custom-rules-panel {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.rule-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
}

.rule-list li {
  padding: 0.5em 0;
  border-bottom: 1px solid #767676;
}

.rule-list li:last-child {
  border-bottom: none;
}

.rule-ref {
  display: block;
  font-size: 0.875rem;
  color: #555;
  margin-left: 1.75rem;
}

.manual-tag {
  font-size: 0.875rem;
  color: #8b0000;
}

.category-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.125em 0.375em;
  border-radius: 0.25rem;
  vertical-align: middle;
  margin-left: 0.25em;
}

.category-msac {
  background: #e0e7ff;
  color: #1e3a5f;
}

/* --- Details / Accordions --- */
details {
  margin: 1rem 0;
  border: 1px solid #767676;
  border-radius: 0.25rem;
}

details > summary {
  padding: 0.75em 1em;
  font-weight: 700;
  cursor: pointer;
  list-style: revert;
}

details > summary:focus {
  outline: 3px solid #0055cc;
  outline-offset: -2px;
}

details[open] > summary {
  border-bottom: 1px solid #767676;
}

details > :not(summary) {
  padding: 0 1em;
}

details.help-accordion {
  background: #f8f8f8;
}

details.guideline-accordion {
  background: #fafafa;
}

details.rule-group {
  border: 1px solid #767676;
  margin: 0.5rem 0;
}

/* --- Severity Badges --- */
.severity-badge {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.15em 0.5em;
  border-radius: 0.2rem;
  white-space: nowrap;
}

.severity-critical {
  background: #8b0000;
  color: #ffffff;
}

.severity-high {
  background: #b44700;
  color: #ffffff;
}

.severity-medium {
  background: #b8860b;
  color: #000000;
}

.severity-low {
  background: #2e6b2e;
  color: #ffffff;
}

/* --- Buttons --- */
.btn-primary {
  display: inline-block;
  font-family: Arial, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  background: #0055cc;
  border: 2px solid #0055cc;
  padding: 0.75em 1.5em;
  border-radius: 0.25rem;
  cursor: pointer;
  text-decoration: none;
  min-width: 44px;
  min-height: 44px;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #003d99;
  border-color: #003d99;
  outline: 3px solid #003d99;
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-block;
  font-family: Arial, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  background: #666666;
  border: 2px solid #666666;
  padding: 0.75em 1.5em;
  border-radius: 0.25rem;
  cursor: pointer;
  text-decoration: none;
  min-width: 44px;
  min-height: 44px;
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: #555555;
  border-color: #555555;
  outline: 3px solid #555555;
  outline-offset: 2px;
}

/* --- Settings Actions Grouping --- */
.settings-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* --- Narrow Input Fields (for threshold numbers, etc.) --- */
.input-narrow {
  max-width: 8rem !important;
}

select.input-narrow {
  max-width: 12rem !important;
}

/* --- Scores --- */
.score-display {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.score-number {
  font-size: 2rem;
  font-weight: 700;
}

.score-grade {
  font-size: 1.333rem;
  font-weight: 700;
}

.grade-a { color: #2e6b2e; }
.grade-b { color: #2e6b2e; }
.grade-c { color: #b8860b; }
.grade-d { color: #cc5500; }
.grade-f { color: #8b0000; }

.score-comparison {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.score-box {
  border: 2px solid #1a1a1a;
  padding: 1rem 1.5rem;
  border-radius: 0.25rem;
  text-align: center;
}

.score-box h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.125rem;
}

.score-arrow {
  font-size: 2rem;
  font-weight: 700;
}

/* --- Error Box --- */
.error-box {
  border: 2px solid #8b0000;
  background: #fff0f0;
  padding: 1rem 1.25rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
}

.error-box p {
  margin: 0;
}

/* --- Flash Messages --- */
[class^="flash-"] {
  padding: 1rem 1.25rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
  border: 2px solid;
}

[class^="flash-"] p {
  margin: 0;
}

.flash-error {
  border-color: #8b0000;
  background: #fff0f0;
  color: #1a1a1a;
}

.flash-success {
  border-color: #2e6b2e;
  background: #f0fff0;
  color: #1a1a1a;
}

.flash-warning {
  border-color: #b8860b;
  background: #fff8e0;
  color: #1a1a1a;
}

.flash-info,
.flash-message {
  border-color: #0055cc;
  background: #f0f5ff;
  color: #1a1a1a;
}

/* --- Textarea --- */
.form-textarea {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 1.125rem;
  padding: 0.5em 0.75em;
  border: 2px solid #1a1a1a;
  border-radius: 0.25rem;
  width: 100%;
  max-width: 40rem;
  background: #ffffff;
}

.form-textarea:focus {
  outline: 3px solid #0055cc;
  outline-offset: 2px;
}

/* --- Tables (findings) --- */
.findings-table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

.findings-table th,
.findings-table td {
  text-align: left;
  padding: 0.5em 0.75em;
  border: 1px solid #666;
  font-size: 1rem;
}

.findings-table th {
  background: #f0f0f0;
  font-weight: 700;
}

/* --- Footer --- */
footer {
  border-top: 2px solid #1a1a1a;
  margin-top: 3rem;
  padding-top: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.footer-links a {
  font-size: 1rem;
  padding: 0.25em 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.footer-links a:focus {
  outline: 3px solid #0055cc;
  outline-offset: 2px;
}

.footer-links a[aria-current="page"] {
  font-weight: 700;
}

footer p {
  font-size: 1rem;
  color: #444;
}

/* --- Visually Hidden (screen reader only) --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Findings Severity Summary --- */
.severity-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  list-style: none;
  padding-left: 0;
}

.severity-summary li {
  font-weight: 700;
}

/* --- Perfect Score Celebration --- */
.celebration {
  border: 3px solid #2e6b2e;
  background: #f0fff0;
  padding: 1.5rem;
  border-radius: 0.5rem;
  text-align: center;
}

.celebration h2 {
  color: #2e6b2e;
  margin-top: 0;
}

.celebration .score-number {
  font-size: 2.5rem;
}

/* --- Back to Top Link --- */
.back-to-top {
  display: inline-block;
  font-size: 1rem;
  margin-top: 0.5rem;
}

/* --- Expand / Collapse All Toggle --- */
.toggle-all-wrap {
  margin-bottom: 1rem;
}

.toggle-all-btn {
  font-family: Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #0055cc;
  background: none;
  border: 2px solid #0055cc;
  padding: 0.4em 1em;
  border-radius: 0.25rem;
  cursor: pointer;
}

.toggle-all-btn:hover,
.toggle-all-btn:focus {
  background: #0055cc;
  color: #ffffff;
  outline: 3px solid #003d99;
  outline-offset: 2px;
}

/* --- Print Stylesheet --- */
@media print {
  .skip-link,
  nav[aria-label="Main navigation"],
  footer,
  .btn-primary,
  .back-to-top,
  .toggle-all-wrap,
  .help-accordion {
    display: none !important;
  }

  body {
    max-width: none;
    padding: 0;
  }

  main {
    padding: 0;
  }

  .card {
    break-inside: avoid;
    border: 1px solid #000;
  }

  .findings-table {
    font-size: 0.875rem;
  }

  .findings-table th,
  .findings-table td {
    padding: 0.25em 0.5em;
  }

  .severity-badge,
  .format-tag,
  .format-pill {
    border: 1px solid currentColor;
    background: transparent !important;
    color: #000 !important;
  }

  details {
    border: none;
  }

  details > summary {
    list-style: none;
    padding: 0;
    font-weight: 700;
  }

  details[open] > summary {
    border-bottom: none;
  }

  /* Force all details open in print */
  details:not([open]) {
    display: block;
  }

  details:not([open]) > *:not(summary) {
    display: block;
  }
}

/* --- Responsive --- */
@media (max-width: 50em) {
  nav[aria-label="Main navigation"] {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-tabs {
    margin: 0 -1rem;
    padding: 0 0.5rem;
  }
}

@media (max-width: 40em) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .score-comparison {
    flex-direction: column;
  }

  .score-arrow {
    transform: rotate(90deg);
  }

  .footer-links {
    flex-direction: column;
    gap: 0;
  }
}

/* --- Help Links (Learn More) --- */
.help-links {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0 0;
  font-size: 0.889rem;
}

.help-links li {
  margin-bottom: 0.15rem;
}

.help-links a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* --- Guide Page --- */
.guide-toc {
  column-count: 2;
  column-gap: 2rem;
  padding-left: 1.5rem;
}

@media (max-width: 40em) {
  .guide-toc {
    column-count: 1;
  }
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.guide-step {
  display: flex;
  gap: 1rem;
  border: 2px solid #0055cc;
  border-radius: 0.25rem;
  padding: 1.25rem;
  background: #f0f5ff;
}

.step-number {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  line-height: 2.5rem;
  text-align: center;
  font-size: 1.333rem;
  font-weight: 700;
  color: #ffffff;
  background: #0055cc;
  border-radius: 50%;
}

.step-content h3 {
  margin-top: 0;
}

.guide-tip {
  background: #fff8e0;
  border-left: 4px solid #b8860b;
  padding: 0.5em 1em;
  font-size: 1rem;
}

/* --- Contextual Workflow Banner --- */
.workflow-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 2px solid #0055cc;
  border-left-width: 5px;
  background: #f0f5ff;
  padding: 1rem 1.25rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
}

.workflow-banner p {
  margin: 0;
}

.workflow-banner .banner-icon {
  flex-shrink: 0;
  font-size: 1.333rem;
}

.workflow-banner a {
  font-weight: 700;
}

/* --- Quick-Start Cards (index) --- */
.quickstart-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.quickstart-step {
  border: 2px solid #0055cc;
  border-top-width: 5px;
  border-radius: 0.25rem;
  padding: 1rem;
  text-align: center;
}

.quickstart-step .qs-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0055cc;
}

.quickstart-step h3 {
  margin: 0.25rem 0 0.5rem;
  font-size: 1.125rem;
}

.quickstart-step p {
  font-size: 1rem;
  margin-bottom: 0;
}

/* --- Changelog --- */
.changelog-content h2 {
  border-bottom: 2px solid #1a1a1a;
  padding-bottom: 0.5rem;
  margin-top: 2.5rem;
}

.changelog-content h3 {
  margin-top: 1.5rem;
  color: #1a1a1a;
}

.changelog-content h4 {
  margin-top: 1.25rem;
}

.changelog-content ul,
.changelog-content ol {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.changelog-content li {
  margin-bottom: 0.25rem;
}

.changelog-content hr {
  border: none;
  border-top: 1px solid #cccccc;
  margin: 2rem 0;
}

.changelog-content code {
  background: #f5f5f5;
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* --- Heading Review --- */
.signal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85em;
}
.signal-list li {
  margin-bottom: 0.15em;
}
.button-group {
  margin-top: 1.5rem;
}
