/* static/css/app.css     */
/* Custom app styles (viewer, pages). Theme and components are built via Sass. */

/* Always reserve space for a vertical scrollbar to avoid layout shift */
body {
  overflow-y: scroll;
}

/* ================================
   Screening List Improvements
   ================================ */
   
/* Enhanced screening card header */
.scr-card .card-header {
  background-color: var(--bs-card-cap-bg);
  border-bottom: 1px solid var(--bs-card-border-color);
}

/* Better spacing for screening detail items */
.scr-detail-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.25rem;
}

.scr-detail-label {
  font-weight: 600;
  margin-right: 0.5rem;
  min-width: 70px;
}

/* Improved badge styling */
.scr-badge-enhanced {
  font-size: 0.75rem;
  padding: 0.25em 0.5em;
  border-radius: 0.375rem;
}

/* Responsive adjustments for screening cards */
@media (max-width: 767.98px) {
  .scr-card .card-header {
    padding: 0.75rem;
  }
  
  .scr-detail-label {
    min-width: 60px;
  }
}

/* ================================
   PDF inside PhotoSwipe
   ================================ */
.pswp__pdfwrap {
  position: absolute;
  /* allow top/left/right/bottom */
  top: 6rem;
  /* push PDF below toolbar */
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
}

.pswp__pdfwrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  filter: none !important;
  /* PDFs should never be filtered */
}



/* ================================
   Captions
   ================================ */
.pswp__custom-caption {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80vw;
  padding: .25rem .5rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.3;
  text-align: center;
  border-radius: 4px;
  z-index: 9000;
  /* below top bar, above slide */
  pointer-events: none;
  /* never block pan/zoom */
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* ================================
   Image filters (SVG filters mapped)
   ================================ */
.pswp-img-filter-greenmono {
  filter: url(#pswp-greenmono);
}

.pswp-img-filter-greenboost {
  filter: url(#pswp-greenboost);
}

.pswp-img-filter-gray {
  filter: url(#pswp-gray);
}

.pswp-img-filter-contrast {
  filter: url(#pswp-contrast);
}

.pswp-img-filter-enhance {
  filter: url(#pswp-enhance);
}

.pswp-img-filter-bluemono {
  filter: url(#pswp-bluemono);
}

/* ================================
   Layout tweaks
   ================================ */
/* Push images down by 20px to avoid overlapping UI */
.pswp__img {
  margin-top: 20px;
  box-sizing: border-box;

}

/* PDF wrapper still below toolbar */
.pswp__pdfwrap {
  position: absolute;
  top: 6rem;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
}

.pswp__pdfwrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  filter: none !important;
}



/* ================================
   Top bar & UI controls
   ================================ */

/* Custom filter buttons */
.pswp__button--filter-redfree,
.pswp__button--filter-greenboost,
.pswp__button--filter-bluemono,
.pswp__button--filter-gray,
.pswp__button--filter-contrast,
.pswp__button--filter-clear {
  width: auto;
  min-width: 28px;
  padding: 0 6px;
  font-size: 0.75rem;
  line-height: 1.6;
  color: #fff;
  background: rgba(20, 126, 6, 0.45);
  border: none;
  border-radius: 3px;
  margin-left: 4px;
  cursor: pointer;
}

.pswp__button.active {
  background-color: #157347 !important;
}



/* ================================
   Site footer
   ================================ */
.site-footer {
  background: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
}

.site-footer .link-body-emphasis:hover {
  text-decoration: underline;
}

.site-footer [data-theme-toggle] {
  line-height: 1.1;
}


/* ===== Zoom slider base ===== */
.pswp__zoom-slider {
  /* make it styleable across browsers */
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 10003;
  width: 160px;
  margin-left: 8px;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  /* allow drags/taps; no double-tap zoom */
  outline: none;
  --pswp-zoom-track: rgba(255, 255, 255, .28);
  /* unfilled */
  --pswp-zoom-fill: rgba(255, 255, 255, .9);
  /* filled */
  --pswp-zoom-thumb: #ffffff;
  /* knob */
  --pswp-zoom-thumb-border: rgba(0, 0, 0, .45);
  --pswp-zoom-track-h: 4px;
  /* track height */
}

/* Light theme: darken track and filled portion for visibility */
[data-bs-theme="light"] .pswp__zoom-slider {
  --pswp-zoom-track: rgba(0, 0, 0, .2);
  --pswp-zoom-fill: rgba(0, 0, 0, .7);
}

/* Focus ring for accessibility */
.pswp__zoom-slider:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .85);
  outline-offset: 2px;
}

/* ===== WebKit (Chrome, Safari) ===== */
/* Track: use a gradient to fake the "filled" portion (we'll set its size via JS) */
.pswp__zoom-slider::-webkit-slider-runnable-track {
  height: var(--pswp-zoom-track-h);
  border-radius: 999px;
  background:
    linear-gradient(to right, var(--pswp-zoom-fill), var(--pswp-zoom-fill)) 0/var(--bg-size, 0%) 100% no-repeat,
    var(--pswp-zoom-track);
}

/* Thumb */
.pswp__zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  width: 14px;
  border-radius: 50%;
  background: var(--pswp-zoom-thumb);
  border: 1px solid var(--pswp-zoom-thumb-border);
  margin-top: calc((var(--pswp-zoom-track-h) - 14px) / 2);
  /* vertically center */
}

/* ===== Firefox ===== */
/* Unfilled track */
.pswp__zoom-slider::-moz-range-track {
  height: var(--pswp-zoom-track-h);
  border-radius: 999px;
  background: var(--pswp-zoom-track);
}

/* Filled portion (from min to current value) */
.pswp__zoom-slider::-moz-range-progress {
  height: var(--pswp-zoom-track-h);
  border-radius: 999px;
  background: var(--pswp-zoom-fill);
}

/* Thumb */
.pswp__zoom-slider::-moz-range-thumb {
  height: 14px;
  width: 14px;
  border-radius: 50%;
  background: var(--pswp-zoom-thumb);
  border: 1px solid var(--pswp-zoom-thumb-border);
}

/* High-contrast mode friendliness */
@media (forced-colors: active) {
  .pswp__zoom-slider {
    forced-color-adjust: auto;
  }
}


/* Ensure the top bar is on top and clickable (keep these if not already present) */
.pswp__top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10002 !important;
  pointer-events: auto !important;
}

.pswp__top-bar * {
  pointer-events: auto !important;
}


/* ===== Large image viewer (CSS-only) ===== */

/* (Optional) wrapper — if present */
.sv-viewer-root {
  width: 100%;
  max-width: 100%;
}

/* Big square viewer */
.sv-main {
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 100%;
  background: #000;
  border-radius: .5rem;
  padding: 2px;              /* add slight padding around image */
  box-sizing: border-box;    /* keep overall size consistent */

  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* keep arrows/counter inside */
}

/* On wider-than-mobile: cap the square by 70% of viewport height */
@media (min-width: 576px) {

  /* fallback */
  .sv-main {
    width: min(100%, 70vh);
  }
}

@supports (height: 1svh) {
  @media (min-width: 576px) {
    .sv-main {
      width: min(100%, 70svh);
    }
  }
}

@supports (height: 1dvh) {
  @media (min-width: 576px) {
    .sv-main {
      width: min(100%, 70dvh);
    }
  }
}

/* Image always fully visible */
.sv-main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* never crop, letterbox on black */
  display: block;
}

/* Controls (match your markup) */
.sv-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sv-prev {
  left: 10px;
}

.sv-next {
  right: 10px;
}

.sv-counter {
  position: absolute;
  top: .5rem;
  left: .5rem;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  padding: .15rem .4rem;
  border-radius: .25rem;
  font-size: .8rem;
}

/* Thumbnails (optional; unchanged) */
.sv-thumbs {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding: .25rem .25rem .5rem;
}

.sv-thumb-link {
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 2px;
  background: #fff;
  flex: 0 0 auto;
}

.sv-thumb-link.active {
  border-color: #0d6efd;
}

.sv-thumb-img {
  height: 64px;
  width: 64px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

/* Make the selected filter button look active */
.sv-filters .btn-check:checked+.btn {
  color: #fff;
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

/* Apply SVG filters to the large image using :has() */
.card:has(.sv-filters input[value="none"]:checked) .sv-main-img {
  filter: none;
}

.card:has(.sv-filters input[value="redfree"]:checked) .sv-main-img {
  filter: url(#pswp-greenmono);
}

.card:has(.sv-filters input[value="greenboost"]:checked) .sv-main-img {
  filter: url(#pswp-greenboost);
}

.card:has(.sv-filters input[value="bluemono"]:checked) .sv-main-img {
  filter: url(#pswp-bluemono);
}

.card:has(.sv-filters input[value="gray"]:checked) .sv-main-img {
  filter: url(#pswp-gray);
}

.card:has(.sv-filters input[value="contrast"]:checked) .sv-main-img {
  filter: url(#pswp-contrast);
}


/* Filename bar under the viewer */
.sv-filebar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .25rem 0 .5rem;
  padding: .35rem .5rem;
  background: var(--bs-light, #f8f9fa);
  border-radius: .375rem;
  min-height: 2rem;
}

.sv-filebar-label {
  color: var(--bs-secondary-color, #6c757d);
  font-size: .85rem;
  flex: 0 0 auto;
}

.sv-filebar-name {
  flex: 1 1 auto;
  min-width: 0;
  /* enables ellipsis */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .9rem;
}

/* Light theme: ensure filename text is dark and readable */
[data-bs-theme="light"] .sv-filebar-name {
  color: var(--bs-body-color, #212529);
}


/* Subtle top navigation for screening detail */
.sv-topbar .btn {
  padding: .15rem .5rem;
  line-height: 1.2;
}


/* Screening detail: lighten filter buttons (R,G,B,Y,H) in Light mode */
[data-bs-theme="light"] .sv-filters .btn.btn-outline-secondary {
  color: var(--bs-dark);
  border-color: var(--bs-dark);
}
[data-bs-theme="light"] .sv-filters .btn.btn-outline-secondary:hover,
[data-bs-theme="light"] .sv-filters .btn.btn-outline-secondary:focus {
  color: var(--bs-dark);
  border-color: var(--bs-dark);
  background-color: rgba(255, 255, 255, 0.08);
}


/* Screening detail: lighten filter buttons (R,G,B,Y,H) in dark mode */
[data-bs-theme="dark"] .sv-filters .btn.btn-outline-secondary {
  color: var(--bs-light);
  border-color: var(--bs-light);
}
[data-bs-theme="dark"] .sv-filters .btn.btn-outline-secondary:hover,
[data-bs-theme="dark"] .sv-filters .btn.btn-outline-secondary:focus {
  color: var(--bs-light);
  border-color: var(--bs-light);
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-subtle {
  border-color: transparent;
  color: var(--bs-secondary-color, #6c757d);
  background: transparent;
}

.btn-subtle:hover,
.btn-subtle:focus {
  color: var(--bs-body-color, #212529);
  border-color: var(--bs-border-color, #dee2e6);
  background: var(--bs-light, #f8f9fa);
}

.btn-subtle:disabled {
  opacity: .55;
  border-color: transparent;
  background: transparent;
  cursor: not-allowed;
}

/* Thin separator */
.vr {
  width: 1px;
  height: 1.25rem;
  background-color: var(--bs-border-color, #dee2e6);
  opacity: .6;
}

/* screenings list cards */
/* tighter cards */
/* Header meta row */
.scr-meta code {
  font-size: .85em;
}

/* Subtle badge for #716 etc. */
.scr-badge {
  background-color: var(--bs-light);
  color: var(--bs-secondary-color);
  font-weight: 400;
  line-height: 1;
}

/* Enhanced badge styling */
.scr-badge-enhanced {
  font-size: 0.75rem;
  padding: 0.25em 0.5em;
  border-radius: 0.375rem;
}

/* Keep cards compact */
.scr-card .card-header {
  padding-top: .5rem;
  padding-bottom: .5rem;
}

.scr-card .card-body {
  padding-top: .75rem;
  padding-bottom: .5rem;
}

/* Allow truncation & compact lists */
.scr-grid .scr-col {
  min-width: 0;
}

.list-compact li {
  margin-bottom: .25rem;
}

/* On large screens, let report/image lists expand; on small, keep them tidy */
.scr-scroll {
  max-height: 260px;
  overflow: auto;
}

@media (min-width: 992px) {
  .scr-scroll {
    max-height: none;
    overflow: visible;
  }
}

/* Thumbnail styling for screening images */
.scr-thumb-container {
  width: 60px;
  height: 60px;
  overflow: hidden;
  border-radius: 0.375rem;
  border: 1px solid var(--bs-border-color);
  background-color: var(--bs-light);
}

.scr-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease-in-out;
}

.scr-thumb-img:hover {
  transform: scale(1.05);
}

.scr-thumb-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 0.375rem;
  border: 1px solid var(--bs-border-color);
  background-color: var(--bs-light);
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
}





/* Pager box that looks like a small button */
/* Pager box to match .btn-sm */
.page-box {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--bs-border-color);
  border-radius: .25rem;
  height: calc(1.5em + .5rem + 2px);
  padding: 0;
  background: transparent
  
}

.page-box:focus-within {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .25)
}

.page-input {
  width: 2.75rem;
  border: 0;
  outline: 0;
  background: transparent;
  text-align: center;
  padding: .25rem .4rem;
  line-height: 1.5;
  font-size: .875rem;
  appearance: textfield;
  -moz-appearance: textfield
}

.page-input::-webkit-outer-spin-button,
.page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0
}

.page-box .sep {
  border-left: 1px solid var(--bs-border-color);
  padding: .25rem .5rem;
  color: var(--bs-secondary-color);
  font-size: .875rem;
  line-height: 1.5
}

.toolbar-status {
  min-height: 1.25rem
}

/* keeps row height steady when no query */


/* Make the badge subtle but visible */
.scr-badge {
  background: var(--bs-light);
  color: var(--bs-secondary-color);
  border: 1px solid var(--bs-border-color);
}

/* Dark mode: ensure readable badge for encounter number */
[data-bs-theme="dark"] .scr-badge {
  background-color: var(--bs-secondary-bg-subtle);
  color: var(--bs-secondary-text-emphasis);
  border-color: var(--bs-secondary-border-subtle);
}

/* Slight emphasis + hover lift for the CTA */
.detail-btn {
  letter-spacing: .01em;
}

.card:hover .detail-btn {
  transform: translateY(-1px);
  box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .08);
}

/* On small screens make the button full width for easier tapping */
@media (max-width: 576px) {
  .detail-btn {
    width: 100%;
    text-align: center;
  }
}

/* Glaucoma edit: make the verify toggle red when not verified */
.form-switch .form-check-input.state-not-verified {
  background-color: var(--bs-danger) !important;
  border-color: var(--bs-danger) !important;
}
.form-switch .form-check-input.state-not-verified:not(:checked) {
  /* white knob over red track when not verified */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23ffffff'/%3E%3C/svg%3E") !important;
}
.form-switch .form-check-input.state-not-verified:focus {
  box-shadow: 0 0 0 .25rem rgba(var(--bs-danger-rgb), .25) !important;
}

/* Grading viewer: keep image anchored to top-left */
.imggr-viewer-root .imggr-main {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  /* background: #000;      ensure black background */
  padding: 2px;          /* small padding around the image */
  box-sizing: border-box;
/* Grading viewer: responsive sizing for 1:1 medical images */
  overflow: hidden;
  
  /* Default for larger screens - container-driven sizing */
  width: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1/1;
}

/* Small screens - width-based */
@media (max-width: 768px) {
  .imggr-viewer-root .imggr-main {
    width: 95vw;
    height: auto;
    max-height: 95vw; /* Maintain 1:1 aspect ratio */
    max-width: 95vw; /* Ensure container doesn't exceed viewport width */
  }
}

.imggr-viewer-root .imggr-main-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left top;
  display: block;
  margin: 0;
  transition: transform 0.12s ease;
  will-change: transform;
}

/* Grading filters: button active state */
.imggr-filters .btn-check:checked + .btn {
  color: #fff;
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

/* Apply SVG filter selections to the grading viewer image */
.card:has(.imggr-filters input[value="none"]:checked) .imggr-main-img { filter: none; }
.card:has(.imggr-filters input[value="redfree"]:checked) .imggr-main-img { filter: url(#pswp-greenmono); }
.card:has(.imggr-filters input[value="greenboost"]:checked) .imggr-main-img { filter: url(#pswp-greenboost); }
.card:has(.imggr-filters input[value="bluemono"]:checked) .imggr-main-img { filter: url(#pswp-bluemono); }
.card:has(.imggr-filters input[value="gray"]:checked) .imggr-main-img { filter: url(#pswp-gray); }
.card:has(.imggr-filters input[value="contrast"]:checked) .imggr-main-img { filter: url(#pswp-contrast); }
.card:has(.imggr-filters input[value="enhance"]:checked) .imggr-main-img { filter: url(#pswp-enhance); }


[data-bs-theme="dark"]  .btn-outline-secondary {
  color: var(--bs-light);
  border-color: var(--bs-light);

}


 /* Base styles for the range input to reset browser defaults */
    .form-range {
        /* Remove default appearance */
        -webkit-appearance: none;
        appearance: none;
        width: 100%;
        height: 8px;
        /* Set a fixed height for the track */
        cursor: pointer;
        background: transparent;
        /* Makes the default track background transparent */
    }

    /* Common track styling for all browsers */
    .form-range::-moz-range-track {
        background-color: #0f3100; /* Example: changes track color */
        border-radius: 4px;        /* Optional: adds rounded corners to the track */
    }
      .form-range::-webkit-slider-runnable-track {
        background-color: #0f3100; /* Example: changes track color to blue */
        border-radius: 4px;        /* Optional: adds rounded corners to the track */
    }
    /* Common thumb styling for all browsers */
    .form-range::-webkit-slider-thumb,
    .form-range::-moz-range-thumb {
        -webkit-appearance: none;      /* Required for styling in WebKit */
        appearance: none;
        width: 16px;
        height: 16px;
        background: #ffffff; /* White thumb color */
        border-radius: 50%;
        border: 1px solid #999;  /* Vertically center the thumb on the track */
        margin-top: -4px;
    }

    /* Focus styles for the slider (works on the overall input element) */
    .form-range:focus {
        /* This removes the default browser focus ring */
        outline: none;
    }

    /* Custom focus outline for the slider thumb */
    .form-range:focus::-webkit-slider-thumb {
        outline: 2px solid #5d9cec;
        /* A clear, vibrant blue outline */
        outline-offset: 4px;
        /* Adds space between the thumb and the outline */
        box-shadow: 0 0 0 2px #ffffff;
        /* Adds a white shadow for high contrast on dark backgrounds */
    }

    .form-range:focus::-moz-range-thumb {
        outline: 2px solid #5d9cec;
        outline-offset: 4px;
        /* Firefox renders the outline in the shape of the thumb, so a box-shadow isn't needed. */
    }

    /* Dark mode adjustments (optional) */
    /*
If your page supports dark mode, this ensures the outline is always visible.
You can use a more specific selector like html[data-theme='dark'] or a class on the body.
*/
    @media (prefers-color-scheme: dark) {
        .form-range:focus::-webkit-slider-thumb {
            outline: 2px solid #5d9cec;
            outline-offset: 4px;
            /* In dark mode, a white box-shadow provides high contrast */
            box-shadow: 0 0 0 2px #ffffff;
        }

      .form-range::-moz-range-track {
        background-color: #e7f0e4; /* Example: changes track color */
        border-radius: 4px;        /* Optional: adds rounded corners to the track */
    }
      .form-range::-webkit-slider-runnable-track {
        background-color: #e7f0e4; /* Example: changes track color to blue */
        border-radius: 4px;        /* Optional: adds rounded corners to the track */
    }
    }

[data-bs-theme=dark] {
        .form-range:focus::-webkit-slider-thumb {
            outline: 2px solid #5d9cec;
            outline-offset: 4px;
            /* In dark mode, a white box-shadow provides high contrast */
            box-shadow: 0 0 0 2px #ffffff;
        }

      .form-range::-moz-range-track {
        background-color: #e7f0e4; /* Example: changes track color */
        border-radius: 4px;        /* Optional: adds rounded corners to the track */
    }
      .form-range::-webkit-slider-runnable-track {
        background-color: #e7f0e4; /* Example: changes track color to blue */
        border-radius: 4px;        /* Optional: adds rounded corners to the track */
    }
}
/* Accessible outline buttons */
[data-bs-theme="light"] .btn-outline-primary {
  color: #075b5d;
  border-color: #0ea5a6;
  background-color: rgba(14, 165, 166, 0.12);
}

[data-bs-theme="light"] .btn-outline-primary:hover,
[data-bs-theme="light"] .btn-outline-primary:focus,
[data-bs-theme="light"] .btn-outline-primary:active,
[data-bs-theme="light"] .btn-outline-primary.active {
  color: #ffffff;
  background-color: #0ea5a6;
  border-color: #0ea5a6;
}

[data-bs-theme="light"] .btn-outline-secondary {
  color: #374151;
  border-color: #5b6073;
  background-color: rgba(91, 96, 115, 0.14);
}

[data-bs-theme="light"] .btn-outline-secondary:hover,
[data-bs-theme="light"] .btn-outline-secondary:focus,
[data-bs-theme="light"] .btn-outline-secondary:active,
[data-bs-theme="light"] .btn-outline-secondary.active {
  color: #ffffff;
  background-color: #5b6073;
  border-color: #5b6073;
}

[data-bs-theme="light"] .btn-outline-primary:focus-visible,
[data-bs-theme="light"] .btn-outline-secondary:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(14, 165, 166, 0.25);
}

[data-bs-theme="dark"] .btn-outline-primary {
  color: rgba(183, 244, 245, 0.9);
  border-color: rgba(14, 165, 166, 0.6);
  background-color: rgba(14, 165, 166, 0.16);
}

[data-bs-theme="dark"] .btn-outline-primary:hover,
[data-bs-theme="dark"] .btn-outline-primary:focus,
[data-bs-theme="dark"] .btn-outline-primary:active,
[data-bs-theme="dark"] .btn-outline-primary.active {
  color: #003637;
  background-color: rgba(14, 165, 166, 0.9);
  border-color: rgba(14, 165, 166, 0.9);
}

[data-bs-theme="dark"] .btn-outline-secondary {
  color: rgba(233, 236, 239, 0.85);
  border-color: rgba(233, 236, 239, 0.5);
  background-color: rgba(233, 236, 239, 0.1);
}

[data-bs-theme="dark"] .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-secondary:focus,
[data-bs-theme="dark"] .btn-outline-secondary:active,
[data-bs-theme="dark"] .btn-outline-secondary.active {
  color: #1f2933;
  background-color: rgba(233, 236, 239, 0.9);
  border-color: rgba(233, 236, 239, 0.9);
}

[data-bs-theme="dark"] .btn-outline-primary:focus-visible,
[data-bs-theme="dark"] .btn-outline-secondary:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(14, 165, 166, 0.3);
}

/* Style guide helpers */
.style-guide-snippet {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.style-guide-snippet code {
  background: rgba(15, 23, 42, 0.08);
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  color: inherit;
}

[data-bs-theme="dark"] .style-guide-snippet code {
  background: rgba(255, 255, 255, 0.1);
}

.style-guide-copy {
  border: 1px solid currentColor;
  border-radius: 0.375rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  background: transparent;
  color: inherit;
}

.style-guide-copy:hover,
.style-guide-copy:focus {
  background: rgba(14, 165, 166, 0.12);
  color: #0ea5a6;
}

.style-guide-copy:focus-visible {
  outline: 2px solid rgba(14, 165, 166, 0.3);
  outline-offset: 1px;
}

/* Soft card readability tweaks */

/* Soft tinted cards */
.card[class*="card-soft-"] {
  color: rgba(17, 24, 39, 0.9);
}

.card[class*="card-soft-"] .small {
  color: rgba(17, 24, 39, 0.7);
}

[data-bs-theme="dark"] .card[class*="card-soft-"] {
  color: rgba(12, 18, 20, 0.92);
}

[data-bs-theme="dark"] .card[class*="card-soft-"] .small,
[data-bs-theme="dark"] .card[class*="card-soft-"] .card-footer {
  color: rgba(12, 18, 20, 0.78);
}

[data-bs-theme="dark"] .card-soft-primary { background-color: rgba(26, 90, 90, 0.6); }
[data-bs-theme="dark"] .card-soft-secondary { background-color: rgba(46, 48, 62, 0.65); }
[data-bs-theme="dark"] .card-soft-success { background-color: rgba(25, 79, 52, 0.65); }
[data-bs-theme="dark"] .card-soft-danger { background-color: rgba(113, 37, 34, 0.65); }
[data-bs-theme="dark"] .card-soft-warning { background-color: rgba(112, 84, 14, 0.7); }
[data-bs-theme="dark"] .card-soft-info { background-color: rgba(32, 76, 108, 0.6); }

/* Image grading sliders */
.imggr-bright,
.imggr-contrast {
  width: 140px;
  min-width: 120px;
  max-width: 200px;
}

.form-range {
  accent-color: #0ea5a6;
}

.form-range:focus {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(14, 165, 166, 0.25);
}

.form-range::-webkit-slider-thumb {
  background: #0ea5a6;
  border: 0;
  width: 1rem;
  height: 1rem;
  margin-top: -0.25rem;
  box-shadow: 0 0 0 2px #fff inset;
}

[data-bs-theme="dark"] .form-range::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px #0f172a inset;
}

.form-range::-webkit-slider-thumb:active {
  background: #0b8c8f;
}

.form-range::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, rgba(14, 165, 166, 0.35), rgba(14, 165, 166, 0.15));
  border-radius: 1rem;
}

.form-range::-moz-range-thumb {
  background: #0ea5a6;
  border: 0;
  width: 1rem;
  height: 1rem;
  box-shadow: 0 0 0 2px #fff inset;
}

[data-bs-theme="dark"] .form-range::-moz-range-thumb {
  box-shadow: 0 0 0 2px #0f172a inset;
}

.form-range::-moz-range-thumb:active {
  background: #0b8c8f;
}

.form-range::-moz-range-track {
  background: linear-gradient(90deg, rgba(14, 165, 166, 0.35), rgba(14, 165, 166, 0.15));
  border-radius: 1rem;
}

/* Style guide helpers */
.style-guide-snippet {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.style-guide-snippet code {
  background: rgba(15, 23, 42, 0.08);
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  color: inherit;
}

[data-bs-theme="dark"] .style-guide-snippet code {
  background: rgba(255, 255, 255, 0.1);
}

.style-guide-copy {
  border: 1px solid currentColor;
  border-radius: 0.375rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  background: transparent;
  color: inherit;
}

.style-guide-copy:hover,
.style-guide-copy:focus {
  background: rgba(14, 165, 166, 0.12);
  color: #0ea5a6;
}

.style-guide-copy:focus-visible {
  outline: 2px solid rgba(14, 165, 166, 0.3);
  outline-offset: 1px;
}
.form-range.form-range-light,
.form-range.form-range-light:focus {
  accent-color: #f8fafc;
}

.form-range.form-range-light::-webkit-slider-thumb {
  background: #f8fafc;
  box-shadow: 0 0 0 2px rgba(8, 24, 39, 0.65) inset;
}

.form-range.form-range-light::-webkit-slider-runnable-track {
  background: rgba(248, 250, 252, 0.65);
}

.form-range.form-range-light::-moz-range-thumb {
  background: #f8fafc;
  box-shadow: 0 0 0 2px rgba(8, 24, 39, 0.65) inset;
}

.form-range.form-range-light::-moz-range-track {
  background: rgba(248, 250, 252, 0.65);
}


.form-check-input[type="checkbox"] {
  border-color: var(--bs-secondary);}

.imggr-controls {
  position: relative;
  --imggr-tooltip-offset: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

.imggr-top-row {
  min-width: 0;
}

.imggr-top-row .imggr-filters {
  flex: 0 0 auto;
}

.imggr-quick-controls {
  flex: 0 0 auto;
  white-space: nowrap;
}


.imggr-cdr-panel {
  display: none;
}

.imggr-cdr-panel.is-active {
  display: block;
}

.imggr-cdr-overlay {

.imggr-cdr-locked .imggr-zoom-slider,
.imggr-cdr-locked .imggr-zoom-fit {
  opacity: 0.55;
  filter: grayscale(0.2);
}
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.imggr-shortcuts-trigger {
  anchor-name: --imggr-shortcuts-anchor;
  font-weight: 600;
  width: 2.35rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding-inline: 0;
}

.imggr-shortcuts-tooltip {
  position: absolute;
  top: calc(100% + var(--imggr-tooltip-offset));
  right: 0;
  width: max-content;
  max-width: 16rem;
  background: var(--bs-body-bg);
  color: inherit;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.35rem);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  z-index: 20;
  pointer-events: none;
}

.imggr-shortcuts-tooltip p,
.imggr-shortcuts-tooltip dl {
  margin-bottom: 0;
}

.imggr-shortcuts-tooltip kbd {
  font-size: 0.75rem;
  border-radius: 0.25rem;
  padding: 0.1rem 0.35rem;
  background: rgba(148, 163, 184, 0.2);
}

.imggr-shortcuts-trigger:hover + .imggr-shortcuts-tooltip,
.imggr-shortcuts-trigger:focus-visible + .imggr-shortcuts-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@supports (anchor-name: --tooltip) {
  .imggr-shortcuts-tooltip {
    position: absolute;
    position-anchor: --imggr-shortcuts-anchor;
    top: anchor(outside-top);
    right: anchor(end);
    transform: none;
    translate: 0 calc(-1 * var(--imggr-tooltip-offset));
  }

  .imggr-shortcuts-trigger:hover + .imggr-shortcuts-tooltip,
  .imggr-shortcuts-trigger:focus-visible + .imggr-shortcuts-tooltip {
    transform: none;
    translate: 0 calc(-1 * (var(--imggr-tooltip-offset) + 0.35rem));
  }
}

.imggr-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.imggr-annot-layout {
  gap: 0.4rem;
}

.imggr-annot-sidebar {
  flex: 0 0 240px;
  width: 240px;
  min-width: 240px;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
}

@media (orientation: portrait) and (min-width: 992px) {
  .imggr-annot-sidebar {
    flex: 0 0 200px;
    width: 200px;
    min-width: 200px;
  }

  .imggr-top-row {
    flex-wrap: wrap !important;
  }

  .imggr-quick-controls {
    order: 3;
    flex: 1 0 100%;
    justify-content: flex-start !important;
  }
}

@media (max-width: 1200px) {
  .imggr-top-row {
    flex-wrap: wrap !important;
  }

  .imggr-quick-controls {
    order: 3;
    flex: 1 0 100%;
    justify-content: flex-start !important;
  }
}

.imggr-main-wrap {
  min-width: 0;
}

.imggr-slider-group {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

.imggr-slider-group .imggr-range-wrap {
  min-width: 0;
}

.grading-workspace {
  justify-content: center;
  align-items: stretch;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: visible;
}

.grading-workspace > [class*="col-"] {
  min-width: 0;
}

@media (min-width: 992px) {
  main > #grading-content-shell.container {
    width: min(96dvw, 2200px);
    max-width: min(96dvw, 2200px);
  }
}

@media (min-width: 992px) and (max-width: 1200px) {
  .imggr-annot-sidebar {
    flex: 0 0 180px;
    width: 180px;
    min-width: 180px;
  }

  main > #grading-content-shell.container {
    width: min(90dvw, 1100px);
    max-width: min(90dvw, 1100px);
  }
}

@media (min-width: 3000px) {
  main > #grading-content-shell.container {
    width: min(94dvw, 2600px);
    max-width: min(94dvw, 2600px);
  }
}

@media (min-width: 2000px) and (min-aspect-ratio: 19/9) {
  main > #grading-content-shell.container {
    width: min(70dvw, 2200px);
    max-width: min(70dvw, 2200px);
  }
}

#image-card,
#image-grading-controls {
  display: flex;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

#image-card > .card,
#image-grading-controls > .card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

#image-card > .card > .card-body,
#image-grading-controls > .card > .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  max-height: 100%;
}

#image-card > .card > .card-body {
  overflow: hidden;
}

#image-card .imggr-viewer-root {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#image-card .imggr-stage,
#image-card .imggr-annot-layout,
#image-card .imggr-main-wrap {
  min-height: 0;
  height: 100%;
}

#image-grading-controls > .card > .card-body {
  overflow-y: scroll;
  overflow-x: hidden;
}

@media (max-width: 992px) {
  .grading-workspace {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  #image-card,
  #image-grading-controls {
    display: block;
    min-height: 0;
    overflow: visible;
  }

  .imggr-annot-layout {
    flex-direction: column;
  }

  .imggr-annot-sidebar {
    flex: initial;
    width: 100%;
    min-width: 0;
    max-height: none;
  }

  #image-card > .card,
  #image-grading-controls > .card {
    min-height: 0;
    flex: initial;
    max-height: none;
    overflow: visible;
  }

  #image-card > .card > .card-body,
  #image-grading-controls > .card > .card-body {
    flex: initial;
    overflow-y: visible;
    overflow-x: visible;
  }
}

.imggr-loupe {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid rgba(248, 250, 252, 0.85);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.95);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
  background-repeat: no-repeat;
  background-size: 200% 200%;
  background-position: center;
  mix-blend-mode: normal;
  background-color: #000;
}

[data-bs-theme="dark"] .imggr-loupe {
  border-color: rgba(248, 250, 252, 0.35);
  mix-blend-mode: normal;
}

.imggr-loupe.is-active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.imggr-range-wrap {
  position: relative;
  width: 100%;
}

.imggr-range-tip {
  position: absolute;
  top: -1.6rem;
  left: 0;
  padding: 0.15rem 0.35rem;
  font-size: 0.75rem;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

/* ================================
   Audio Player Cross-Browser Fix
   ================================ */

/* Reset audio element styling when used with form-control class */
audio.form-control {
  /* Remove Bootstrap form-control styling that conflicts with audio player */
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  height: auto;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  /* Ensure proper audio player display */
  display: inline-block;
  width: auto;
  min-width: 300px; /* Ensure minimum width for controls */
  max-width: 100%;
}

/* Chrome-specific audio player fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  audio.form-control {
    /* Chrome-specific fixes */
    -webkit-appearance: none;
    appearance: none;
    outline: none;
  }
  
  /* Ensure audio controls are visible in Chrome */
  audio.form-control::-webkit-media-controls-panel {
    display: flex !important;
  }
  
  /* Fix play button icon visibility in Chrome */
  audio.form-control::-webkit-media-controls-play-button {
    display: inherit !important;
    -webkit-appearance: media-play-button !important;
  }
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
  audio.form-control {
    /* Firefox-specific fixes */
    min-height: 40px; /* Ensure adequate height for controls */
  }
}

/* Safari-specific fixes */
_::-webkit-full-page-media, _:future, :root audio.form-control {
  /* Safari-specific fixes */
  min-height: 40px; /* Ensure adequate height for controls */
}

/* General audio player styling for consistency */
audio {
  outline: none;
  border: none;
  background: transparent;
}

/* Ensure audio player is visible in all themes */
[data-bs-theme="light"] audio.form-control {
  filter: none;
}

[data-bs-theme="dark"] audio.form-control {
  filter: none;
}

.linked-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.linked-dot {
  line-height: 0;
}

.linked-primary-toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 110, 253, 0.95);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 1050;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
