/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Misspellings in the care plan editor, drawn by app/javascript/spelling/
 * highlights.js through the CSS Custom Highlight API. The native browser
 * spellchecker is switched off on those editors (it flags every medical term),
 * so this is the only underline an editor sees. skip-ink is disabled because
 * the wavy line breaks up badly against descenders at this size.
 *
 * This lives here rather than in app/assets/tailwind/application.css because
 * Tailwind v4 runs its output through Lightning CSS, whose selector database
 * does not yet know ::highlight() — it compiles the rule correctly but warns
 * on every build. Propshaft serves this file unprocessed.
 */
::highlight(spelling-error) {
  text-decoration: red wavy underline;
  text-decoration-skip-ink: none;
}

/* House-style issues — a repeated word, a paragraph with no full stop. Amber
 * rather than red, and dotted rather than wavy, because these are conventions
 * worth following rather than things that are outright wrong, and an editor
 * should be able to tell the two apart without opening the menu. */
::highlight(prose-issue) {
  text-decoration: #b45309 dotted underline;
  text-decoration-thickness: 2px;
  text-decoration-skip-ink: none;
}

.action-tag {
  background: #E6D0D9;
}

.action-tag-early_detection {
  background: #FCE083;
}

.styled-select-wrapper {
  ol { display: none; }

  .indicator {
    opacity: 0;
    transition: opacity 0.2s;
  }

  &:has(input[type="radio"]:checked) .toggle-label {
    top: 15px;
    font-size: 13px;
  }

  label:has(input[type="radio"]:checked) .indicator {
    opacity: 100;
  }
}

.styled-select-wrapper:has(input[type="checkbox"]:checked) ol {
  display: block;
}

/* Tooltip styles */
.tooltip-popup {
  position: fixed;
  z-index: 9999;
  padding: 8px 12px;
  background: #1f2937;
  color: white;
  font-size: 13px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  animation: tooltip-fade-in 0.15s ease-out;
  max-width: 280px;
}

.tooltip-popup::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 6px 6px 6px;
  border-style: solid;
  border-color: transparent transparent #1f2937 transparent;
}

.tooltip-popup.tooltip-above::before {
  top: auto;
  bottom: -6px;
  border-width: 6px 6px 0 6px;
  border-color: #1f2937 transparent transparent transparent;
}

.tooltip-hotkey {
  display: block;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: #d1d5db;
  font-size: 12px;
}

.tooltip-popup kbd {
  display: inline-block;
  padding: 2px 6px;
  margin-left: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  color: white;
}

/* The small reward for uploading a screening report: the "on file" row pops in
   once, on the turbo stream that replaces the upload prompt. */
.upload-celebrate {
  animation: upload-celebrate 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes upload-celebrate {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  60% {
    transform: scale(1.03);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .upload-celebrate {
    animation: none;
  }
}

@keyframes tooltip-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}