/*
 * FileRackRack shared UI states
 * --------------------------------
 * This file owns interaction states and Semantic presentation.
 * Page CSS must not redefine shared hover/active/focus/disabled behavior.
 * Focus is independent from Semantic colors.
 */

/* -------------------------------------------------------------------------
 * Interaction states
 * ------------------------------------------------------------------------- */

html body :where(button,input[type="submit"],input[type="button"],input[type="reset"],.btn,.nav-btn,.file-picker-btn,.secondary-btn,.pw-toggle,.copybtn,.copy)
:is(:hover,.frr-sample-hover)
:not(:disabled):not([aria-disabled="true"]):not(.disabled):not([data-frr-state="loading"]) {
  filter:brightness(.95)!important;
}

html body :where(button,input[type="submit"],input[type="button"],input[type="reset"],.btn,.nav-btn,.file-picker-btn,.secondary-btn,.pw-toggle,.copybtn,.copy)
:is(:active,.frr-sample-active)
:not(:disabled):not([aria-disabled="true"]):not(.disabled):not([data-frr-state="loading"]) {
  transform:translateY(1px);
}

html body :where(button,a,input,select,textarea,[tabindex]:not([tabindex="-1"]),.btn,.nav-btn,.file-picker-btn,.secondary-btn,.pw-toggle,.copybtn,.copy)
:is(:focus-visible,.frr-sample-focus) {
  outline:var(--frr-focus-outline-width,3px) solid var(--frr-border-focus)!important;
  outline-offset:var(--frr-focus-outline-offset,2px)!important;
  box-shadow:var(--frr-focus-glow,none)!important;
}

/* Programmatic return-location marker, e.g. returning from a Rack share. */

html body .frr-return-target:focus {
  outline:var(--frr-focus-outline-width,3px) solid var(--frr-border-focus)!important;
  outline-offset:var(--frr-focus-outline-offset,2px)!important;
  box-shadow:var(--frr-focus-glow,none)!important;
}

html body :where(
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]):not([type=submit]):not([type=button]):not([type=reset]):not([type=range]):not([type=image]):not([type=hidden]),
  textarea,select
):focus {
  border-color:var(--frr-input-focus,var(--frr-border-focus))!important;
  outline:var(--frr-focus-outline-width,3px) solid var(--frr-border-focus)!important;
  outline-offset:var(--frr-focus-outline-offset,2px)!important;
  box-shadow:var(--frr-focus-glow,none)!important;
}

html body :where(button,input[type="submit"],input[type="button"],input[type="reset"],.btn,input,select,textarea):is(:disabled,[aria-disabled="true"],.disabled) {
  opacity:.62!important;
  cursor:not-allowed!important;
  filter:none!important;
  transform:none!important;
}

html body :where(.btn,.nav-btn,.file-picker-btn,.secondary-btn,.pw-toggle,.copybtn,.copy):is([aria-disabled="true"],.disabled) {
  pointer-events:none;
}

html body :where(button,input[type="submit"],input[type="button"],input[type="reset"],.btn)[data-frr-state="loading"] {
  cursor:wait!important;
}

html body :where(.primary-upload-btn,#quickUploadButton,.quick-upload-btn,[data-frr-role="upload-submit"],[data-frr-role="pending-upload"],[data-frr-role="quick-upload"])
:is(:disabled,[aria-disabled="true"],[data-frr-state="loading"],.disabled) {
  text-shadow:none!important;
  box-shadow:none!important;
}

/* -------------------------------------------------------------------------
 * Semantic action buttons
 * -------------------------------------------------------------------------
 * Semantic action buttons are Strong/Button2 operations whose meaning changes
 * the fill. Typography follows Button2. Link history never recolors them.
 */

html body :is(.danger,.danger-solid,.danger-btn,.frr-dialog-danger,.nav-btn.logout,[data-semantic="delete"],[data-semantic="danger"]) {
  background:var(--fr-status-danger)!important;
  color:#fff!important;
  border-color:var(--fr-status-danger)!important;
  font-weight:var(--frr-weight-button2-text)!important;
}

html body :is(a.danger,a.danger-solid,a.danger-btn,a.nav-btn.logout,a[data-semantic="delete"],a[data-semantic="danger"]):is(:link,:visited) {
  color:#fff!important;
  font-weight:var(--frr-weight-button2-text)!important;
}

/* Edition-mode action is intentionally rendered as an inactive/secondary semantic action. */

html body .license-standard-mode-button {
  background:var(--fr-status-inactive,#8a929f)!important;
  color:#fff!important;
  border-color:var(--fr-status-inactive,#8a929f)!important;
  font-weight:var(--frr-weight-button2-text)!important;
}

/* Emergency resume remains a danger-related action, but uses an outlined treatment. */

html body .emergency-resume {
  background:var(--frr-panel-fill)!important;
  color:var(--fr-status-danger,#a00020)!important;
  border-color:var(--fr-status-danger,#a00020)!important;
  font-weight:var(--frr-weight-button2-text)!important;
}

/* Upload category contract.
 * Text glow remains the established FRR effect; only the foreground ownership
 * is explicit here so Theme/visited-link colors can never replace it. */

html body :is(.primary-upload-btn,[data-frr-role="upload-submit"]) {
  background:var(--fr-status-success)!important;
  border-color:var(--fr-status-success)!important;
  color:#fff!important;
  font-weight:var(--frr-weight-button2-text)!important;
  text-shadow:0 0 3px rgba(255,255,255,.95),0 0 9px rgba(255,255,255,.58)!important;
}

html body :is(.primary-upload-btn,[data-frr-role="upload-submit"])[data-state="empty"] {
  background:var(--fr-status-inactive)!important;
  border-color:var(--fr-status-inactive)!important;
  color:#000!important;
  font-weight:var(--frr-weight-button2-text)!important;
  text-shadow:none!important;
  box-shadow:none!important;
}

html body :is(.primary-upload-btn,[data-frr-role="upload-submit"])[data-state="attention"] {
  background:var(--fr-status-added)!important;
  border-color:var(--fr-status-added)!important;
  color:#000!important;
  font-weight:var(--frr-weight-button2-text)!important;
  text-shadow:none!important;
  box-shadow:none!important;
}

html body :is(.primary-upload-btn,[data-frr-role="upload-submit"])[data-state="ready"] {
  background:var(--fr-status-success)!important;
  border-color:var(--fr-status-success)!important;
  color:#fff!important;
  font-weight:var(--frr-weight-button2-text)!important;
  text-shadow:0 0 3px rgba(255,255,255,.95),0 0 9px rgba(255,255,255,.58)!important;
  box-shadow:none!important;
}

html body :is(.pending-upload-btn,[data-frr-role="pending-upload"]) {
  background:var(--fr-status-info)!important;
  border-color:var(--fr-status-info)!important;
  color:#fff!important;
  font-weight:var(--frr-weight-button2-text)!important;
  text-shadow:0 0 3px rgba(255,255,255,.95),0 0 9px rgba(255,255,255,.58)!important;
  box-shadow:none!important;
}

html body :is(.pending-upload-btn,[data-frr-role="pending-upload"])[data-state="empty"] {
  background:var(--fr-status-inactive)!important;
  border-color:var(--fr-status-inactive)!important;
  color:#000!important;
  font-weight:var(--frr-weight-button2-text)!important;
  text-shadow:none!important;
  box-shadow:none!important;
}

html body :is(.pending-upload-btn,[data-frr-role="pending-upload"])[data-state="attention"] {
  background:var(--fr-status-added)!important;
  border-color:var(--fr-status-added)!important;
  color:#000!important;
  font-weight:var(--frr-weight-button2-text)!important;
  text-shadow:none!important;
  box-shadow:none!important;
}

html body :is(.pending-upload-btn,[data-frr-role="pending-upload"])[data-state="ready"] {
  background:var(--fr-status-info)!important;
  border-color:var(--fr-status-info)!important;
  color:#fff!important;
  font-weight:var(--frr-weight-button2-text)!important;
  text-shadow:0 0 3px rgba(255,255,255,.95),0 0 9px rgba(255,255,255,.58)!important;
  box-shadow:none!important;
}

html body :is(.quick-upload-btn,#quickUploadButton,[data-frr-role="quick-upload"]) {
  background:var(--fr-status-quick-upload)!important;
  color:#fff!important;
  border-color:var(--fr-status-quick-upload)!important;
  font-weight:var(--frr-weight-button2-text)!important;
  text-shadow:0 0 3px rgba(255,255,255,.95),0 0 9px rgba(255,255,255,.58)!important;
  box-shadow:0 0 5px 1px rgba(255,255,255,.78),
    0 0 15px 3px color-mix(in srgb,var(--fr-status-quick-upload) 66%,transparent),
    0 0 28px 7px color-mix(in srgb,var(--fr-status-quick-upload) 34%,transparent)!important;
}

/* -------------------------------------------------------------------------
 * Semantic message surfaces
 * ------------------------------------------------------------------------- */

html body .frr-notice-box {
  padding:14px 16px;
  border:1px solid;
  border-radius:10px;
}

html body .frr-critical-notice {
  background:var(--fr-status-danger)!important;
  color:#fff!important;
  border-color:var(--fr-status-danger)!important;
}

html body .frr-critical-notice :is(strong,p) {
  color:#fff!important;
}

html body input[aria-invalid="true"] {
  border-color:var(--fr-status-danger)!important;
}

html body .frr-field-error {
  color:var(--fr-status-danger)!important;
}

html body .notice:not(.frr-critical-notice) {
  background:color-mix(in srgb,var(--fr-status-info) var(--frr-semantic-mix),var(--frr-panel-fill))!important;
  border-color:color-mix(in srgb,var(--fr-status-info) var(--frr-semantic-emphasis),var(--frr-panel-line))!important;
  color:var(--frr-panel-text)!important;
}

html body :is(.success,.ok):not(.frr-critical-notice) {
  background:color-mix(in srgb,var(--fr-status-success) var(--frr-semantic-mix),var(--frr-panel-fill))!important;
  border-color:color-mix(in srgb,var(--fr-status-success) var(--frr-semantic-emphasis),var(--frr-panel-line))!important;
  color:var(--frr-panel-text)!important;
}

html body :is(.warning,.warn,.setup-warning,.ip-pending):not(.frr-critical-notice) {
  background:color-mix(in srgb,var(--fr-status-warning) var(--frr-semantic-mix),var(--frr-panel-fill))!important;
  border-color:color-mix(in srgb,var(--fr-status-warning) var(--frr-semantic-emphasis),var(--frr-panel-line))!important;
  color:var(--frr-panel-text)!important;
}

html body :is(.flash.error,.action-feedback.error,.frr-feedback.error,.error,.err):not(.frr-critical-notice) {
  background:color-mix(in srgb,var(--fr-status-danger) var(--frr-semantic-mix),var(--frr-panel-fill))!important;
  border-color:color-mix(in srgb,var(--fr-status-danger) var(--frr-semantic-emphasis),var(--frr-panel-line))!important;
  color:var(--frr-panel-text)!important;
}

html body .notice strong {
  color:color-mix(in srgb,var(--fr-status-info) var(--frr-semantic-emphasis),var(--frr-panel-text))!important;
}

html body :is(.success strong,.ok strong) {
  color:color-mix(in srgb,var(--fr-status-success) var(--frr-semantic-emphasis),var(--frr-panel-text))!important;
}

html body :is(.setup-warning strong,.ip-pending strong,.warn strong,.warning strong) {
  color:color-mix(in srgb,var(--fr-status-warning) var(--frr-semantic-emphasis),var(--frr-panel-text))!important;
}

html body :is(.flash.error strong,.action-feedback.error strong,.frr-feedback.error strong,.error strong,.err strong) {
  color:var(--fr-status-danger)!important;
}

html body .frr-license-warning {
  max-width:920px!important;
  box-sizing:border-box!important;
  padding:12px 14px!important;
  margin:0 0 14px!important;
  border:2px solid color-mix(in srgb,var(--fr-status-warning) var(--frr-semantic-emphasis),var(--frr-panel-line))!important;
  border-radius:10px!important;
  background:color-mix(in srgb,var(--fr-status-warning) var(--frr-semantic-mix),var(--frr-panel-fill))!important;
  color:var(--frr-panel-text)!important;
}

html body .frr-license-warning strong {
  color:color-mix(in srgb,var(--fr-status-warning) var(--frr-semantic-emphasis),var(--frr-panel-text))!important;
}

/* Upload entry areas are guidance surfaces, not independent color systems. */

html body .dropzone {
  background:color-mix(in srgb,var(--fr-status-info) var(--frr-semantic-mix),var(--frr-panel-fill))!important;
  border-color:color-mix(in srgb,var(--fr-status-info) var(--frr-semantic-border-mix),var(--frr-panel-line))!important;
  color:var(--frr-panel-text)!important;
}

html body .dropzone.dragover {
  background:color-mix(in srgb,var(--fr-status-info) var(--frr-semantic-mix),var(--frr-panel-fill))!important;
  border-color:color-mix(in srgb,var(--fr-status-info) var(--frr-semantic-emphasis),var(--frr-panel-line))!important;
}

html body .picker-choice-panel {
  background:color-mix(in srgb,var(--fr-status-success) var(--frr-semantic-mix),var(--frr-panel-fill))!important;
  border-color:color-mix(in srgb,var(--fr-status-success) var(--frr-semantic-border-mix),var(--frr-panel-line))!important;
  color:var(--frr-panel-text)!important;
}

html body .picker-choice-actions .file-picker-btn,
html body .file-picker-status.dropped {
  background:var(--frr-panel-fill)!important;
  color:var(--frr-panel-text)!important;
  border-color:var(--frr-panel-line)!important;
}

/* -------------------------------------------------------------------------
 * Badges
 * -------------------------------------------------------------------------
 * Status/Semantic badges: 700. Meta/attribute badges: 600.
 * Text is white by default. Explicit light badges and the Notice OK/Warning/
 * Critical markers use black. Edition badges are owned by frr-core.css.
 */

html body :is(.frr-badge,.level,.diagnosis-badge) {
  display:inline-block!important;
  border-radius:999px!important;
  font-weight:700!important;
}

html body .frr-badge {
  padding:2px 8px!important;
  font-size:.78em!important;
  line-height:1.45!important;
  border:0!important;
  color:#fff!important;
}

html body :is(.frr-badge-danger,.file-change-badge.replaced) {
  background:var(--fr-status-danger)!important;
  color:#fff!important;
}

html body .frr-badge-added {
  background:var(--fr-status-added)!important;
  color:#fff!important;
}

html body .frr-badge-previous {
  background:var(--fr-status-previous)!important;
  color:#000!important;
}

html body .frr-badge-previous2 {
  background:color-mix(in srgb,var(--fr-status-previous) 58%,var(--fr-status-inactive))!important;
  color:#000!important;
}

html body .frr-badge-success {
  background:var(--fr-status-success)!important;
  color:#fff!important;
}

html body .frr-badge-warning {
  background:var(--fr-status-warning)!important;
  color:#fff!important;
}

html body .frr-badge-info {
  background:var(--fr-status-info)!important;
  color:#fff!important;
}

html body .frr-badge-inactive {
  background:var(--fr-status-inactive)!important;
  color:#fff!important;
}

/* Rack state badges use the same Semantic fill irrespective of page Surface. */

html body .rack-status-badge.frr-badge-success {
  background:var(--fr-status-success)!important;
  color:#fff!important;
}

html body .rack-status-badge.frr-badge-warning {
  background:var(--fr-status-warning)!important;
  color:#fff!important;
}

html body .rack-status-badge.frr-badge-danger {
  background:var(--fr-status-danger)!important;
  color:#fff!important;
}

html body .rack-status-badge.frr-badge-inactive {
  background:var(--fr-status-inactive)!important;
  color:#fff!important;
}

html body .rack-status-badge.frr-badge-info {
  background:var(--fr-status-info)!important;
  color:#fff!important;
}

/* Notice / diagnosis badges: OK, Warning and Critical are explicit black-text exceptions. */

html body .diagnosis-badge.ok {
  background:var(--fr-status-success)!important;
  color:#000!important;
}

html body .diagnosis-badge.warn {
  background:var(--fr-status-warning)!important;
  color:#000!important;
}

html body .diagnosis-badge.manual {
  background:var(--fr-status-info)!important;
  color:#fff!important;
}

html body .diagnosis-badge.danger {
  background:var(--fr-status-danger)!important;
  color:#fff!important;
}

html body .critical .level {
  background:var(--fr-status-danger)!important;
  color:#000!important;
}

html body .warning .level {
  background:var(--fr-status-warning)!important;
  color:#000!important;
}

html body .notice .level {
  background:var(--fr-status-info)!important;
  color:#fff!important;
}

html body .normal .level {
  background:var(--fr-status-inactive)!important;
  color:#fff!important;
}

/* Auxiliary FRR badges follow the same badge contract. */

html body :is(.storage-residual,.setup-status-badge) {
  display:inline-block;
  border-radius:999px;
  font-weight:700!important;
  color:#fff!important;
}

html body .setup-status-badge {
  background:var(--fr-status-warning)!important;
  border-color:var(--fr-status-warning)!important;
}

html body .storage-residual {
  color:#fff!important;
}

html body :is(.brand-status-badge,.frr-theme-official-badge) {
  font-weight:600!important;
}

/* Light/meta badges are deliberately black and independent from text-link roles. */

html body :is(.xmp-sidecar-badge,.share-kind-badge) {
  display:inline-block;
  vertical-align:middle;
  padding:2px 8px;
  border-radius:999px;
  font-size:.78em;
  font-weight:600!important;
  line-height:1.45;
  color:#000!important;
}

html body .xmp-sidecar-badge {
  background:color-mix(in srgb,var(--fr-status-info) 28%,#fff)!important;
  border:1px solid color-mix(in srgb,var(--fr-status-info) 52%,#fff)!important;
}

html body .share-kind-badge {
  background:#f2f2f2!important;
  border:1px solid #c8c8c8!important;
}

html body .downloaded-check {
  display:none;
  margin-left:7px;
  padding:2px 8px;
  border:1px solid color-mix(in srgb,var(--fr-status-inactive) 48%,#fff)!important;
  border-radius:999px!important;
  background:color-mix(in srgb,var(--fr-status-inactive) 24%,#fff)!important;
  color:#000!important;
  font-size:.78em!important;
  font-weight:700!important;
  line-height:1.45!important;
  white-space:nowrap;
  text-shadow:none!important;
  box-shadow:none!important;
  vertical-align:middle;
}

html body .download-track-row.is-downloaded {
  opacity:1!important;
}

html body .download-track-row.is-downloaded .downloaded-check {
  display:inline-block!important;
}

html body .download-track-row.is-downloaded .file-change-badge {
  opacity:1!important;
}

html body .download-track-row.is-downloaded :is(.file-preview-box,.file-list-size) {
  opacity:.76;
}

/* -------------------------------------------------------------------------
 * Semantic containers and special states
 * ------------------------------------------------------------------------- */

html body .rack-card-pending {
  border-color:color-mix(in srgb,var(--fr-status-warning) var(--frr-semantic-mix),var(--frr-panel-line))!important;
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--fr-status-warning) var(--frr-semantic-mix),transparent)!important;
}

html body .rack-card-returned {
  border-color:color-mix(in srgb,var(--fr-status-danger) var(--frr-semantic-mix),var(--frr-panel-line))!important;
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--fr-status-danger) var(--frr-semantic-mix),transparent)!important;
}

html body .frr-log-summary-box.is-warning-active {
  border-color:color-mix(in srgb,var(--fr-status-warning) var(--frr-semantic-emphasis),var(--frr-panel-line))!important;
}

html body .frr-log-summary-box.is-danger-active {
  border-color:color-mix(in srgb,var(--fr-status-danger) var(--frr-semantic-emphasis),var(--frr-panel-line))!important;
}

html body :where(.frr-override-indicator,.frr-standard-mode-indicator,.frr-test-license-indicator) {
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  box-sizing:border-box!important;
  max-width:calc(100vw - 28px)!important;
  padding:9px 13px!important;
  border:1px solid transparent!important;
  border-radius:999px!important;
  font-family:inherit!important;
  font-size:12px!important;
  font-weight:700!important;
  line-height:1.4!important;
  letter-spacing:normal!important;
  white-space:nowrap!important;
  text-decoration:none!important;
  text-shadow:none!important;
  box-shadow:0 8px 26px rgba(0,0,0,.22)!important;
  cursor:pointer!important;
}

html body .frr-floating-state-indicator:is(.frr-override-indicator,.frr-standard-mode-indicator,.frr-test-license-indicator) {
  position:fixed!important;
  right:14px!important;
  bottom:30px;
  z-index:15000!important;
}

html body .frr-standard-mode-indicator {
  background:var(--fr-status-inactive)!important;
  border-color:var(--fr-status-inactive)!important;
  color:#fff!important;
}

html body .frr-test-license-indicator {
  background:var(--fr-status-info)!important;
  border-color:var(--fr-status-info)!important;
  color:#fff!important;
}

html body .frr-override-campaign {
  background:color-mix(in srgb,var(--fr-status-success) var(--frr-semantic-emphasis),var(--frr-panel-fill))!important;
  border-color:color-mix(in srgb,var(--fr-status-success) var(--frr-semantic-emphasis),var(--frr-panel-fill))!important;
  color:var(--frr-override-campaign-text,#000)!important;
}

html body .frr-override-emergency {
  background:var(--fr-status-danger)!important;
  border-color:var(--fr-status-danger)!important;
  color:#fff!important;
}

html body .progressbar {
  height:var(--frr-progress-height,18px)!important;
  padding:0!important;
  box-sizing:border-box;
  overflow:hidden;
  border:1px solid var(--frr-panel-line)!important;
  background:var(--frr-panel-fill)!important;
  border-radius:999px;
}

html body .progressbar>span {
  display:block;
  height:100%;
  min-height:0!important;
  background:var(--frr-progress-fill,var(--frr-button2-fill))!important;
}

html body :is(#progressText,.frr-notice-text) {
  overflow-wrap:anywhere;
}

html body :is(#progressBox.uploading-sticky,.frr-notice-box) {
  box-sizing:border-box;
  max-height:calc(100dvh - 32px);
  overflow:auto;
}
