/* src/hud-hotkey-bar.css
 * HOTKEY-BAR-V3-01 (#2908) — 4×10 action bar visual renderer.
 * Companion CSS for src/hud-hotkey-bar.js.
 */

/* ── Container ─────────────────────────────────────────────────────────── */

#hud-hotkey-bar {
  display: flex;
  flex-direction: column-reverse;   /* bar 1 at bottom; bars 2–4 stack above */
  align-items: center;
  gap: 3px;
  pointer-events: none;             /* key input via router, not click targets */
  /* Backing panel — separates the bar from the game world floor texture */
  background: rgba(6, 6, 10, 0.88);
  border-radius: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset,
              0 4px 18px rgba(0, 0, 0, 0.55);
}

/* ── Bar row ───────────────────────────────────────────────────────────── */

.hud-hs__bar {
  display: flex;
  flex-direction: row;
  gap: 3px;
}

/* ── Slot ──────────────────────────────────────────────────────────────── */

.hud-hs__slot {
  position: relative;
  width:  52px;
  height: 52px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 4px;
  overflow: hidden;
  box-sizing: border-box;
  pointer-events: auto;   /* opt back in from container's none — enables drag-and-drop, click-to-assign, context menu */
  transition: transform 200ms ease-out;
}

.hud-hs__slot:hover {
  transform: scale(1.05);
  z-index: 1;
}

/* ── Empty state ───────────────────────────────────────────────────────── */

.hud-hs__slot--empty {
  border-color: rgba(255, 255, 255, 0.16);
}

.hud-hs__slot--empty .hud-hs__badge {
  opacity: 0.4;
}

/* ── Icon ──────────────────────────────────────────────────────────────── */

.hud-hs__icon {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1;
}

/* ── Cooldown overlay ──────────────────────────────────────────────────── */

.hud-hs__cd-overlay {
  position: absolute;
  inset: 0;
  --cd-remaining: 0;
  background: conic-gradient(
    rgba(0, 0, 0, 0.72) calc(var(--cd-remaining) * 360deg),
    transparent 0
  );
  pointer-events: none;
}

/* ── Cooldown timer text ───────────────────────────────────────────────── */

.hud-hs__cd-timer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* ── Keybind badge — bottom-left ───────────────────────────────────────── */

.hud-hs__badge {
  position: absolute;
  bottom: 2px;
  left: 3px;
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1;
  pointer-events: none;
}

/* ── Item stack count — bottom-right ──────────────────────────────────── */

.hud-hs__stack {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  line-height: 1;
  pointer-events: none;
}

/* ── Item-empty state (0 count) ───────────────────────────────────────── */

.hud-hs__slot--item-empty .hud-hs__icon {
  opacity: 0.4;
}

.hud-hs__slot--item-empty .hud-hs__stack {
  color: rgba(255, 255, 255, 0.5);
}

/* ── Active-press state (keydown feedback) ─────────────────────────────── */

.hud-hs__slot--active-press {
  filter: brightness(1.45);
}

/* ── Ready-flash animation (cooldown expired) ──────────────────────────── */

@keyframes hs-ready-flash {
  0%   { filter: brightness(2.0); }
  100% { filter: brightness(1.0); }
}

.hud-hs__slot--ready-flash {
  animation: hs-ready-flash 0.3s ease-out forwards;
}

/* ── Use-rejected flash ────────────────────────────────────────────────── */

@keyframes hs-use-rejected {
  0%,100% { opacity: 1;    border-color: rgba(255, 60, 60, 0.9); }
  50%      { opacity: 0.35; border-color: rgba(255, 60, 60, 0.9); }
}

.hud-hs__slot--use-rejected {
  animation: hs-use-rejected 0.3s ease-in-out;
}

/* ── GCD dim — occupied non-offGcd slots dimmed during global cooldown ──── */

.hud-hs__slot--gcd-active .hud-hs__icon {
  opacity: 0.45;
}

/* ── Drag-and-drop + assignment UX (HOTKEY-ASSIGNMENT-UX-01 #2918) ─────── */

.hud-hs__slot--drag-target {
  border-color: rgba(0, 191, 255, 0.85);
  box-shadow: 0 0 8px rgba(0, 191, 255, 0.45);
}

.hud-hs__slot--dragging {
  opacity: 0.4;
}

/* Assign mode: crosshair cursor on all slots */
.hud-hs--assign-mode .hud-hs__slot {
  cursor: crosshair;
}

.hud-hs--assign-mode .hud-hs__slot:hover {
  border-color: rgba(106, 255, 190, 0.7);
  box-shadow: 0 0 6px rgba(106, 255, 190, 0.4);
}

/* ── Add-bar toggle button ──────────────────────────────────────────────── */
/* Button is a flex sibling of #hud-hotkey-bar inside #hud-bottom-bar.      */
/* It sits to the LEFT of the bar grid. align-self:flex-end aligns it with  */
/* bar 1 at the visual bottom of the hotbar stack.                           */

.hud-hs__add-bar {
  flex-shrink: 0;
  align-self: flex-end;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.hud-hs__add-bar:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

/* ── Slot tooltip ───────────────────────────────────────────────────────── */

.hud-hs__tooltip {
  position: fixed;
  z-index: 8000;
  background: rgba(15, 15, 15, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  padding: 6px 10px;
  pointer-events: none;
  max-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
}

.hud-hs__tooltip-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.hud-hs__tooltip-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 3px;
  line-height: 1.4;
}

.hud-hs__tooltip-cd {
  font-size: 10px;
  color: rgba(180, 180, 255, 0.85);
  margin-top: 3px;
}

.hud-hs__tooltip-hint {
  font-size: 10px;
  color: rgba(160, 210, 255, 0.55);
  margin-top: 5px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

/* ── Reduced-motion accessibility (WCAG 2.3.3) ──────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .hud-hs__slot {
    transition: none;
  }
  .hud-hs__slot:hover {
    transform: none;
  }
}

/* ── Right-click "Assign Skill" picker — HOTBAR-RCLICK-ASSIGN-PICKER-01 (#3395) ─ */

.hud-hs-assign-picker {
  position: fixed;
  z-index: 9999;
  background: rgba(15, 15, 15, 0.97);
  border: 1px solid rgba(0, 191, 255, 0.4);
  border-radius: 6px;
  padding: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.8);
  font-family: inherit;
  display: none;
  min-width: 150px;
  max-width: 300px;
  pointer-events: auto;
}

.hud-hs-assign-picker__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(0, 191, 255, 0.9);
  margin: 0 2px 6px;
}

.hud-hs-assign-picker__row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 280px;
}

.hud-hs-assign-picker__skill {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.6);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.hud-hs-assign-picker__skill:hover:not(:disabled) {
  border-color: rgba(0, 191, 255, 0.85);
  box-shadow: 0 0 7px rgba(0, 191, 255, 0.5);
}

.hud-hs-assign-picker__skill:disabled {
  opacity: 0.35;
  cursor: default;
  filter: grayscale(0.7);
}

.hud-hs-assign-picker__empty {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  padding: 4px 2px;
}

.hud-hs-assign-picker__err {
  font-size: 10px;
  color: rgba(255, 130, 130, 0.9);
  background: rgba(255, 60, 60, 0.10);
  border-radius: 3px;
  padding: 3px 6px;
  margin-top: 4px;
}

.hud-hs-assign-picker__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.hud-hs-assign-picker__clear {
  flex: 1;
  background: rgba(255, 60, 60, 0.12);
  border: 1px solid rgba(255, 90, 90, 0.4);
  border-radius: 3px;
  color: rgba(255, 140, 140, 0.95);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
}

.hud-hs-assign-picker__clear:hover {
  background: rgba(255, 60, 60, 0.22);
}

.hud-hs-assign-picker__close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.hud-hs-assign-picker__close:hover {
  color: #fff;
}

/* PS-FEEL-08: anticipation flash when keypress fires before server ack */
.hud-hs__slot--anticipating {
  box-shadow: 0 0 10px 3px rgba(245, 158, 11, 0.75),
              0 0 0 2px rgba(245, 158, 11, 0.5);
  border-color: rgba(245, 158, 11, 0.8) !important;
  transition: box-shadow 0ms, border-color 0ms;
}
