/* Shared interactive-control sizing for AdminApp and PassApp. */
:root {
  --q-control-height: 2rem;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="color"]),
select {
  box-sizing: border-box;
  height: var(--q-control-height) !important;
  min-height: var(--q-control-height) !important;
  padding-block: 0.25rem !important;
  line-height: 1rem !important;
}

button:not([role="checkbox"]):not([role="radio"]):not([role="switch"]):not([role="tab"]):not([role="menuitem"]):not([data-sidebar]):not(.q-inline-control) {
  box-sizing: border-box;
  height: auto !important;
  min-height: var(--q-control-height) !important;
  padding-block: 0.25rem !important;
}

button:not([role="combobox"]):has(> svg:only-child):not(.q-inline-control):not(.w-full) {
  width: var(--q-control-height) !important;
  padding-inline: 0.25rem !important;
}

.pass-theme > button {
  width: var(--q-control-height) !important;
}

:root {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
  width: 0.375rem;
  height: 0.375rem;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 0;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover,
[data-scrollarea] [role="scrollbar"]:hover [data-scrollarea-thumb] {
  background: var(--muted-foreground);
}

::-webkit-scrollbar-thumb:active {
  background: var(--primary);
}

[data-scrollarea] [role="scrollbar"] {
  width: 0.375rem !important;
  padding: 0 !important;
  border: 0 !important;
}

[data-scrollarea] [role="scrollbar"][aria-orientation="horizontal"] {
  height: 0.375rem !important;
}

/* QHint: pure-CSS tooltip bubble (AGENTS.md §6). Shared here so every app that loads
 * quba-controls.css renders the hint as a hover/focus bubble. Without these rules the
 * bubble span is plain inline text next to its control.
 * span.q-hint wraps the control + a bubble span. When the wrapped child is focusable the
 * wrapper is not (TabIndex="-1" omits the attribute). The bubble shows on hover, on keyboard
 * focus of the inner control (:has(:focus-visible)), and on :active for the tap flash.
 * Positions via data-pos, tones via data-tone. */
.q-hint {
  position: relative;
}
.q-hint-bubble {
  position: absolute;
  z-index: 200;
  display: none;
  max-width: 22rem;
  min-width: max-content;
  padding: 0.375rem 0.625rem;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 400;
  white-space: normal;
  text-align: left;
  color: var(--popover-foreground);
  background-color: var(--popover);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
  pointer-events: none;
}
.q-hint:hover > .q-hint-bubble,
.q-hint:focus > .q-hint-bubble,
.q-hint:has(:focus-visible) > .q-hint-bubble,
.q-hint:active > .q-hint-bubble {
  display: block;
}
.q-hint[data-pos="top"] > .q-hint-bubble {
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
}
.q-hint[data-pos="bottom"] > .q-hint-bubble {
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
}
.q-hint[data-pos="left"] > .q-hint-bubble {
  right: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
}
.q-hint[data-pos="right"] > .q-hint-bubble {
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
}
.q-hint[data-tone="warn"] > .q-hint-bubble {
  border-color: var(--color-amber-600);
  background-color: var(--alert-warning-bg);
  color: var(--alert-warning-foreground);
}
.q-hint[data-tone="danger"] > .q-hint-bubble {
  border-color: var(--destructive);
  background-color: var(--alert-danger-bg);
  color: var(--alert-danger-foreground);
}
.q-hint:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* JS tooltip portal: quba-tooltip.js mirrors the bubble text into #quba-tooltip (fixed, on
 * <body>) so hints escape overflow-clipped ancestors. Same look as the CSS bubble. */
.has-js-tooltips .q-hint > .q-hint-bubble {
  display: none !important;
}
#quba-tooltip {
  position: fixed;
  z-index: 1000;
  display: none;
  pointer-events: none;
  max-width: 22rem;
  padding: 0.375rem 0.625rem;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 400;
  white-space: normal;
  text-align: left;
  color: var(--popover-foreground);
  background-color: var(--popover);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}
#quba-tooltip[data-tone="warn"] {
  border-color: var(--color-amber-600);
  background-color: var(--alert-warning-bg);
  color: var(--alert-warning-foreground);
}
#quba-tooltip[data-tone="danger"] {
  border-color: var(--destructive);
  background-color: var(--alert-danger-bg);
  color: var(--alert-danger-foreground);
}
@media (max-width: 480px) {
  #quba-tooltip {
    max-width: calc(100vw - 16px);
  }
}
