/* Avery UI: responsive tables + focus / toggle accessibility */

.table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
}

.table-scroll:focus,
.table-scroll:focus-visible,
div.dataTables_wrapper:focus,
div.dataTables_wrapper:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.45);
  outline-offset: 2px;
}

.table-scroll > table,
div.dataTables_wrapper table.dataTable {
  margin-bottom: 0;
}

/* Sticky headers for plain scrollable tables (DataTables FixedHeader covers #lijst) */
.table-scroll:not(.dataTables_wrapper) thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: #fff;
  box-shadow: 0 1px 0 #dee2e6;
}

/* DataTables Responsive child rows (card-like on narrow viewports) */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.child,
table.dataTable.dtr-column.collapsed > tbody > tr > td.child {
  background-color: #f8f9fa;
  padding: 0.75rem 1rem;
}

table.dataTable > tbody > tr.child ul.dtr-details {
  display: block;
  width: 100%;
}

table.dataTable > tbody > tr.child span.dtr-title {
  font-weight: 700;
  min-width: 8rem;
  display: inline-block;
}

/* Focus states beyond buttons (base already styles .btn:focus) */
a:focus-visible,
.nav-link:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.page-link:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.45);
  outline-offset: 2px;
}

.form-check-input[role="switch"] {
  cursor: pointer;
  width: 2.25em;
  height: 1.15em;
  margin-top: 0.2em;
}

.form-check-input[role="switch"]:focus-visible {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.35);
}

.form-check.form-switch .form-check-label {
  font-weight: 600;
  margin-left: 0.25rem;
}

/* Slightly stronger contrast for secondary/outline actions on white */
.btn-outline-secondary {
  color: #343a40;
  border-color: #6c757d;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
  color: #fff;
  background-color: #6c757d;
  border-color: #6c757d;
}

/* Organisation upload links: clear missing vs subtle present state */
.org-upload-link--present {
  color: #5f6b7a;
}

.org-upload-link--present:hover,
.org-upload-link--present:focus-visible {
  color: #4b5663;
}

.org-upload-link--missing {
  color: #b3261e;
  font-weight: 600;
}

.org-upload-link--missing:hover,
.org-upload-link--missing:focus-visible {
  color: #8f1f19;
}

/* Rich text (Quill / Trix) — replaces CKEditor.
   Only hide the textarea after JS successfully mounts the editor
   (.avery-richtext-source); otherwise keep the field usable. */
textarea.avery-richtext-source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.avery-quill .ql-toolbar.ql-snow {
  border-radius: 0.25rem 0.25rem 0 0;
  background: #f8f9fa;
}

.avery-quill .ql-container.ql-snow {
  min-height: 8rem;
  border-radius: 0 0 0.25rem 0.25rem;
  font-size: 1rem;
}

.avery-quill .ql-editor {
  min-height: 8rem;
}

/* Trix: hide attachments / code / headings; slim basic vs full */
trix-toolbar .trix-button-group--file-tools,
trix-toolbar .trix-button--icon-attach,
trix-toolbar .trix-button--icon-code,
trix-toolbar .trix-button--icon-heading-1,
trix-toolbar .trix-button--icon-quote,
trix-toolbar .trix-button--icon-decrease-nesting-level,
trix-toolbar .trix-button--icon-increase-nesting-level {
  display: none !important;
}

trix-toolbar:has(+ .avery-trix--basic) .trix-button--icon-strike,
trix-toolbar:has(+ .avery-trix--basic) .trix-button--icon-link,
trix-toolbar:has(+ .avery-trix--basic) .trix-button--icon-number-list {
  display: none !important;
}

trix-editor.avery-trix {
  min-height: 8rem;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  background: #fff;
}

trix-toolbar {
  background: #f8f9fa;
  border: 1px solid #ced4da;
  border-bottom: 0;
  border-radius: 0.25rem 0.25rem 0 0;
}

trix-toolbar + trix-editor.avery-trix {
  border-radius: 0 0 0.25rem 0.25rem;
}

/* Global button visibility and accessibility tweaks (from base.html.twig) */
.btn { font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.btn:focus, .btn.focus, .btn:focus-visible { outline: 3px solid rgba(13,110,253,.35); outline-offset: 2px; }
.btn-sm { padding: .3rem .6rem; font-size: .875rem; }
.btn-xs { padding: .15rem .35rem; font-size: .75rem; border-radius: .2rem; }
a.btn { text-decoration: none !important; }
.btn-link { font-weight: 600; text-decoration: underline; }
.btn-link.btn-success, .btn-link.btn-danger, .btn-link.btn-primary { text-decoration: none; }
.link-white a { color: #fff !important; text-decoration: underline; }
.btn.btn-link { padding: .25rem .5rem; }
.nav-tabs .nav-link.active { font-weight: 700; }
.btn-default { color: #fff; background-color: #6c757d; border: 1px solid #495057; }
.btn-default:hover { color: #fff; background-color: #495057; border-color: #343a40; }
.btn-xl { padding: .75rem 1.5rem; font-size: 1.1rem; }
.btn-light { border-color: #dee2e6; }
.btn-light:hover { background-color: #e2e6ea; border-color: #adb5bd; }

/* Flip panels (organisation / rate / user show) */
#panel, #flip, #change, #cpanel {
  padding: 3px;
  text-align: center;
  background-color: #e5eecc;
  border: solid 1px #c3c3c3;
}
#panel, #cpanel {
  display: none;
}
#panel.avery-panel-left,
#cpanel.avery-panel-left {
  text-align: left;
}

/* Rate qualification star UI */
.star-rating { display: inline-flex; gap: 4px; vertical-align: middle; }
.star-rating .star { font-size: 1.4rem; color: #ccc; cursor: pointer; user-select: none; }
.star-rating .star.filled { color: #f5c518; }
.rate-panel { border: 1px solid #e1e1e1; border-radius: 4px; margin-bottom: 10px; }
.rate-panel .rate-body { padding: 8px; }
@media (max-width: 767.98px) {
  .rate-form .col-md-6 { margin-bottom: 1rem; }
}

/* Rate show: assess stars */
.assess-list { list-style: none; padding-left: 0; margin: 0; }
.assess-list > li { margin-bottom: 6px; }
.assess-star-filled { color: #f5c518; }
.assess-star-empty { color: #ccc; }
.assess-star-value { margin-left: 6px; color: #666; }
.assess-comment { color: #333; }

/* Score index readability */
.score-index .bg-primary {
  background-color: #cfe8ff !important;
  color: #000 !important;
}
.score-index-doc-cell {
  vertical-align: top;
  min-width: 320px;
}
.score-index-pdf-preview {
  display: block;
  width: 320px;
  max-width: 100%;
  height: 355px;
  border: 1px solid #ccc;
  background: #f5f5f5;
}

/* Answer quiz typography + large checkboxes */
.answer-quiz input.larger {
  width: 30px;
  height: 30px;
}
.answer-quiz h1 { font-size: 1rem; }
@media (min-width: 544px) {
  .answer-quiz h1 { font-size: 1.5rem; }
}
@media (min-width: 768px) {
  .answer-quiz h1 { font-size: 2rem; }
}
@media (min-width: 992px) {
  .answer-quiz h1 { font-size: 2.5rem; }
}
@media (min-width: 1200px) {
  .answer-quiz h1 { font-size: 3rem; }
}
@media (min-width: 950px) and (max-width: 1100px) {
  .answer-quiz h1 { font-size: 2.75rem; }
}

/* Test image thumbs */
.img-thumb-sm { height: 50px; }
.img-thumb-lg { height: 100px; }
