/* ==========================================================================
 * Rent Ready Web Design System v1.0.0 . rubrics page
 *
 * Components for api/templates/rubrics.html only. Loaded after base.css.
 * The bare `button` rule below is why this file is not merged with
 * upload.css: it would restyle every button on the upload page too.
 * ========================================================================== */

/* Rubrics buttons are sized by this bare rule where they carry no size of
 * their own. Class selectors in base.css still win on colour and radius. */
button {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-button);
  font-weight: 600;
  cursor: pointer;
}

/* ---- Tabs --------------------------------------------------------------
 * A skillset switcher, not a sequence, so no numbering. */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.tab-button {
  padding: 10px 16px;
  min-height: 40px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}

.tab-button:hover {
  color: var(--color-text);
}

.tab-button.active {
  color: var(--color-text);
  border-bottom-color: var(--color-cyan-500);
}

.tab-content {
  display: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 24px;
}

@media (min-width: 1024px) {
  .tab-content {
    padding: 32px;
  }
}

.tab-content.active {
  display: block;
}

/* ---- Thresholds -------------------------------------------------------- */

.threshold-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.threshold-input {
  display: flex;
  flex-direction: column;
}

.threshold-input label {
  margin-bottom: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.threshold-input input {
  padding: 12px 16px;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-input);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.threshold-input input:focus {
  outline: none;
  border-color: var(--color-cyan-500);
  box-shadow: 0 0 0 2px var(--color-cyan-ring);
}

/* ---- Check list -------------------------------------------------------- */

.checks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.check-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 20px;
}

.check-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

/* The check id is the record's identifier, so it stays navy and reads as
 * data. The weight is the metric, so it takes the accent. */
.check-id {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
}

.check-weight {
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  background: var(--color-cyan-tint);
  color: var(--color-cyan-800);
  font-size: var(--text-caption);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.check-description {
  margin-bottom: 12px;
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  color: var(--color-text-secondary);
}

.check-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keyword-tag {
  padding: 3px 8px;
  border-radius: var(--radius-chip);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.edit-controls {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.edit-controls input,
.edit-controls textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-input);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-sm);
}

.edit-controls input:focus,
.edit-controls textarea:focus {
  outline: none;
  border-color: var(--color-cyan-500);
  box-shadow: 0 0 0 2px var(--color-cyan-ring);
}

.edit-controls textarea {
  grid-column: 1 / -1;
  resize: vertical;
  min-height: 60px;
  line-height: var(--leading-body);
}

.button-group {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.add-check-btn {
  width: 100%;
  border: 1px dashed var(--color-border-medium);
  background: transparent;
  color: var(--color-text-secondary);
}

.add-check-btn:hover {
  border-color: var(--color-cyan-500);
  border-style: solid;
  color: var(--color-cyan-800);
  background: var(--color-cyan-tint-soft);
}

/* ---- Help affordance --------------------------------------------------- */

.help-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  background: var(--color-cyan-500);
  color: var(--color-navy-500);
  border: none;
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-elevated);
  transition: transform var(--duration-fast) var(--ease-standard);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-button:hover {
  transform: scale(1.05);
}

/* ---- Help modal -------------------------------------------------------- */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-scrim);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--color-surface);
  border-radius: var(--radius-panel);
  padding: 32px;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
  position: relative;
}

@media (min-width: 1024px) {
  .modal-content {
    padding: 40px;
  }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--duration-fast) var(--ease-standard);
}

.modal-close:hover {
  background: var(--color-navy-a05);
  color: var(--color-text);
}

.modal h2 {
  margin: 0 0 20px;
  font-size: var(--text-2xl);
}

.modal h3 {
  margin: 28px 0 10px;
  font-size: var(--text-lg);
  color: var(--color-text);
}

.modal p,
.modal li {
  margin: 10px 0;
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  color: var(--color-text-secondary);
}

.modal strong {
  color: var(--color-text);
  font-weight: 600;
}

/* ---- Reference tables inside the modal --------------------------------- */

.weight-examples {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  padding: 16px;
  margin: 16px 0;
  overflow-x: auto;
}

.weight-examples table {
  width: 100%;
  border-collapse: collapse;
}

.weight-examples th {
  text-align: left;
  padding: 8px;
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-medium);
}

.weight-examples td {
  padding: 8px;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border);
}

/* The cyan rule marks this as the formula, the one thing on the page worth
 * quoting verbatim. */
.formula-box {
  background: var(--color-cyan-tint-soft);
  border-left: 4px solid var(--color-cyan-500);
  padding: 16px;
  margin: 16px 0;
  border-radius: var(--radius-chip);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: var(--text-sm);
  color: var(--color-text);
}

/* ---- Mobile ------------------------------------------------------------ */

@media (max-width: 640px) {
  .threshold-controls,
  .edit-controls {
    grid-template-columns: 1fr;
  }

  .tab-content,
  .modal-content {
    padding: 20px;
  }

  .button-group {
    flex-wrap: wrap;
  }
}

/* Total row of the weighting example, and the footnote beneath it. Both were
 * inline style attributes referencing the retired --rr-* tokens. */
.weight-examples .total-row td {
  border-top: 2px solid var(--color-cyan-500);
  border-bottom: none;
}

.modal-note {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-medium);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

/* Shown when a rubric could not be read. Coral marks the warning; the text is
 * navy so it stays legible. This state exists so a failed read is never
 * mistaken for an empty rubric. */
.load-error {
  padding: 14px 16px;
  border: 1px solid var(--color-coral-500);
  border-left-width: 4px;
  border-radius: var(--radius-button);
  background: var(--color-coral-tint);
  color: var(--color-text);
  font-size: var(--text-sm);
}

.btn-primary:disabled,
.add-check-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
