/*
 * The hotbar below the game screen (src/ui/hotbar-manager.js), laid out as Minibia's: the group buttons 1-6 in two rows
 * left of twelve slots, each with its key in the corner. The windows of the hotbar (Add to Hotbar, Change Key) and the
 * menu of a slot follow, in the dark windows with golden edges of the client (shop.css, modal.css).
 */

:root {
  --hotbar-gold: #d8b55a;
  --hotbar-gold-light: #f1d27a;
  --hotbar-gold-dark: #8a6a1c;
  --hotbar-slot-bg: #1e1e1e;
  --hotbar-text: #e2e2e2;
  --hotbar-muted: #9a9a9a;
}

.hotbar {
  height: 48px;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.hotbar-groups {
  display: grid;
  grid-template-columns: repeat(3, 18px);
  grid-template-rows: repeat(2, 18px);
  gap: 3px;
}

.hotbar-group {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  font: bold 10px Verdana, sans-serif;
  line-height: 16px;
  color: var(--hotbar-muted);
  background: linear-gradient(180deg, #333 0%, #1c1c1c 100%);
  border: 1px solid #000;
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.hotbar-group:hover {
  color: var(--hotbar-text);
}

.hotbar-group.active {
  color: var(--hotbar-gold-light);
  border-color: var(--hotbar-gold);
  box-shadow: inset 0 0 4px rgba(216, 181, 90, 0.45), 0 0 3px rgba(216, 181, 90, 0.35);
}

.hotbar-group:focus-visible {
  outline: 1px solid var(--hotbar-gold-light);
  outline-offset: 1px;
}

.hotbar-slots {
  display: flex;
  align-items: center;
}

.hotbar-item:hover {
  cursor: pointer;
  border-color: rgba(216, 181, 90, 0.75);
  box-shadow: 0 0 6px 0 rgba(216, 181, 90, 0.45), inset 0 0 6px rgba(0, 0, 0, 0.8);
}

/* The flash of a slot when it is used (HotbarManager.__handleLightUp); other buttons of the client with the class
   "active" have always had it too */
.active {
  animation: fade 0.25s ease-in-out;
}

@keyframes fade {
  0% {   box-shadow: 0px 0px 0px 0px white; }
  50% {   box-shadow: 0px 0px 10px 0px white; }
  100% {   box-shadow: 0px 0px 0px 0px white; }
}

.hotbar-item {
  color: grey;
  display: flex;
  height: 34px;
  width: 34px;
  box-sizing: border-box;
  user-select: none;
  align-items: center;
  justify-content: center;
  border: 1px solid #000;
  border-radius: 3px;
  background-color: var(--hotbar-slot-bg);
  background-image: url("/png/bg2.png");
  margin: 2px;
  position: relative;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.6);
}

/* A slot dragged onto another swaps with it (HotbarManager.__handleSlotDragEnd) */
.hotbar.hotbar-dragging .hotbar-item {
  cursor: grabbing;
}

.hotbar-item .hotbar-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px;
  z-index: 10;
  font-size: 8px;
  color: white;
  text-align: center;
  pointer-events: none;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

/* The key of the slot (HotbarManager.__showKeys), over the icon as on Minibia */
.hotbar-item .hotbar-key {
  font: bold 8px Verdana, sans-serif;
  pointer-events: none;
  position: absolute;
  left: 2px;
  top: 1px;
  z-index: 11;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.hotbar-item canvas {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  width: 32px;
  height: 32px;
}

/* TabTibia r107: the count of the item of a slot, in its corner (HotbarManager.__showItemCount); red when none is left */
.hotbar-item .hotbar-text.hotbar-count {
  left: auto;
  right: 2px;
  bottom: 1px;
  font-size: 10px;
  font-weight: bold;
  text-align: right;
}

.hotbar-item .hotbar-text.hotbar-count-none {
  color: #ff5a5a;
}

/* ------------------------------------------------------------------------------------------- the menu of a slot */

#hotbar-menu {
  width: max-content;
  min-width: 120px;
}

#hotbar-menu > .menu-header {
  font: bold 12px Verdana, sans-serif;
  text-align: left;
  padding: 3px 8px;
}

#hotbar-menu button {
  display: block;
  font: 11px Verdana, sans-serif;
  text-align: left;
  padding: 3px 8px;
  white-space: nowrap;
}

#hotbar-menu .menu-separator {
  height: 1px;
  margin: 2px 4px;
  background: rgba(255, 255, 255, 0.15);
}

#hotbar-menu button.menu-danger {
  color: #ff8a7a;
}

#hotbar-menu button:disabled {
  color: #666;
  cursor: default;
}

/* ------------------------------------------------------------------------------- the windows of the hotbar */

.hotbar-window {
  color: var(--hotbar-text);
  font-family: Verdana, Tahoma, "DejaVu Sans", Roboto, sans-serif;
  font-size: 11px;
  border: 1px solid #000;
  box-shadow: 0 0 14px 0 #000, 0 0 0 1px rgba(255, 200, 90, 0.25);
}

.hotbar-window .modal-header {
  font-weight: bold;
  font-size: 12px;
}

.hotbar-window [hidden] {
  display: none !important;
}

.hotbar-window button {
  font-family: inherit;
}

#hotbar-add-modal {
  width: 440px;
  max-width: calc(100vw - 16px);
}

#hotbar-key-modal {
  width: 320px;
  max-width: calc(100vw - 16px);
}

.hotbar-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #000;
  border-radius: 4px;
  box-shadow: inset 0 0 6px #000;
}

.hotbar-tab {
  margin: 0;
  padding: 5px 0;
  font: bold 11px Verdana, sans-serif;
  color: #c8c8c8;
  background: linear-gradient(180deg, #3a3a3a 0%, #232323 100%);
  border: 1px solid #111;
  border-radius: 4px;
  cursor: pointer;
}

.hotbar-tab:hover {
  color: #fff;
}

.hotbar-tab.active {
  color: var(--hotbar-gold-light);
  border-color: var(--hotbar-gold);
  box-shadow: inset 0 0 6px rgba(216, 181, 90, 0.3), 0 0 4px rgba(216, 181, 90, 0.25);
}

.hotbar-pane {
  margin-top: 8px;
}

.hotbar-list {
  height: 236px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #000;
  border-radius: 4px;
  box-shadow: inset 0 0 6px #000;
  scrollbar-width: thin;
}

.hotbar-list-tall {
  height: 280px;
}

.hotbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.hotbar-row:hover,
.hotbar-row:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.hotbar-row.selected {
  background: rgba(216, 181, 90, 0.16);
  box-shadow: inset 0 0 0 1px rgba(216, 181, 90, 0.55);
}

.hotbar-row-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #000;
  border-radius: 3px;
  image-rendering: pixelated;
}

.hotbar-row-main {
  flex: 1 1 auto;
  min-width: 0;
}

.hotbar-row-name {
  font-weight: bold;
  font-size: 12px;
  color: #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hotbar-row-words {
  margin-left: 6px;
  font-style: italic;
  font-weight: normal;
  color: var(--hotbar-gold);
}

.hotbar-row-desc {
  color: #a9a9a9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hotbar-row.expanded .hotbar-row-desc {
  white-space: normal;
}

.hotbar-row-vocations {
  color: #c87f55;
  font-size: 10px;
}

.hotbar-row-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.hotbar-row.unusable .hotbar-row-icon,
.hotbar-row.unusable .hotbar-row-main {
  opacity: 0.45;
}

.hotbar-row.unusable .hotbar-row-icon {
  filter: grayscale(1);
}

.hotbar-badge {
  font: bold 10px Verdana, sans-serif;
  padding: 1px 6px;
  color: #c8c8c8;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #000;
  border-radius: 3px;
  white-space: nowrap;
}

.hotbar-badge-mana {
  color: #8fb0ff;
}

.hotbar-badge-premium {
  color: var(--hotbar-gold-light);
}

.hotbar-help {
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  font-weight: bold;
  color: #fff;
  background: #151515;
  border: 1px solid #000;
  border-radius: 50%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.hotbar-help:hover {
  border-color: var(--hotbar-gold);
}

.hotbar-empty {
  padding: 18px 12px;
  color: var(--hotbar-muted);
  text-align: center;
}

.hotbar-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 4px;
  color: var(--hotbar-gold);
  font: bold 10px Verdana, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hotbar-section-title::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: rgba(216, 181, 90, 0.35);
}

.hotbar-list .hotbar-section-title {
  margin: 8px 10px 2px;
}

.hotbar-item-name {
  color: #f0f0f0;
  letter-spacing: 0;
  text-transform: none;
}

.hotbar-hint {
  margin: 2px 0 8px;
  color: #bdbdbd;
}

.hotbar-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.hotbar-mode {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #000;
  border-radius: 4px;
  cursor: pointer;
}

.hotbar-mode:has(input:checked) {
  border-color: var(--hotbar-gold);
  background: rgba(216, 181, 90, 0.12);
}

.hotbar-mode.disabled {
  opacity: 0.4;
  cursor: default;
}

.hotbar-mode span {
  display: flex;
  flex-direction: column;
}

.hotbar-mode small {
  color: var(--hotbar-muted);
  font-size: 10px;
}

.hotbar-window .hotbar-search,
.hotbar-window .hotbar-text-input {
  width: 100%;
  height: auto;
  margin: 0;
  box-sizing: border-box;
  padding: 7px 10px;
  font: 12px Verdana, sans-serif;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #000;
  border-radius: 4px;
  box-shadow: inset 0 0 6px #000;
}

.hotbar-window .hotbar-search:focus,
.hotbar-window .hotbar-text-input:focus {
  outline: 1px solid rgba(216, 181, 90, 0.6);
}

.hotbar-check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  cursor: pointer;
}

.hotbar-check small {
  color: var(--hotbar-muted);
}

.hotbar-text-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hotbar-key-badge {
  flex: 0 0 auto;
  min-width: 34px;
  height: 34px;
  box-sizing: border-box;
  padding: 3px 4px;
  font: bold 10px Verdana, sans-serif;
  color: #d0d0d0;
  background: var(--hotbar-slot-bg);
  border: 1px solid #000;
  border-radius: 4px;
  box-shadow: inset 0 0 6px #000;
}

.hotbar-key-big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  height: 44px;
  font-size: 16px;
  color: var(--hotbar-gold-light);
  border-color: var(--hotbar-gold-dark);
}

.hotbar-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.hotbar-examples-label {
  color: var(--hotbar-muted);
  font: bold 10px Verdana, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hotbar-chip {
  margin: 0;
  padding: 3px 10px;
  font-weight: bold;
  color: #e8e8e8;
  background: #141414;
  border: 1px solid #000;
  border-radius: 12px;
  cursor: pointer;
}

.hotbar-chip:hover {
  border-color: var(--hotbar-gold);
}

.hotbar-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.hotbar-window .hotbar-actions-row button,
.hotbar-footer button {
  margin: 0;
  min-width: 64px;
  padding: 4px 12px;
  font-weight: bold;
  border-radius: 4px;
}

.hotbar-window button.hotbar-confirm {
  color: var(--hotbar-gold-light);
  border: 1px solid var(--hotbar-gold);
  box-shadow: inset 0 0 6px rgba(216, 181, 90, 0.25);
}

.hotbar-footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hotbar-transfer-text {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font: 11px monospace;
  color: #e6e6e6;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #000;
  border-radius: 4px;
}

.hotbar-transfer-status,
.hotbar-key-status {
  min-height: 14px;
  margin: 6px 0 0;
  color: #bdbdbd;
}

.hotbar-transfer-status.ok {
  color: #8fd18f;
}

.hotbar-transfer-status.error,
.hotbar-key-status.error {
  color: #ff8a7a;
}

.hotbar-key-capture {
  display: flex;
  justify-content: center;
  margin: 6px 0 10px;
}

.hotbar-key-lists {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ----------------------------------------------------------------------------- the phone and the tablet */

body.force-mobile .hotbar-list {
  height: min(300px, calc(100dvh - 300px));
  min-height: 160px;
}

body.force-mobile .hotbar-row {
  min-height: 44px;
}

body.force-mobile .hotbar-help {
  width: 32px;
  height: 32px;
}

body.force-mobile .hotbar-modes {
  grid-template-columns: 1fr;
}

body.force-mobile .hotbar-tab {
  min-height: 36px;
  font-size: 13px;
}

body.force-mobile .hotbar-check input[type="checkbox"] {
  width: 22px;
  height: 22px;
}
