/*
 * Vitals & Telemetry HUD Bar
 * Built with semantic HTML <progress> elements per Modern Web Guidance
 */

:root {
  --hud-height: 42px;
  --bottom-bar-height: 68px;
  --sidebar-width: 270px;
}

#vitals-hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--hud-height);
  background: rgba(15, 18, 24, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #2d3748;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 13px;
  color: #e2e8f0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  user-select: none;
  box-sizing: border-box;
}

/* Adjust GoldenLayout container so HUD and bottom bar do not occlude game panes */
#clientwrapper {
  padding-top: var(--hud-height) !important;
  padding-bottom: var(--bottom-bar-height) !important;
  height: 100% !important;
  box-sizing: border-box !important;
}

#clientwrapper #main {
  height: calc(100% - var(--hud-height) - var(--bottom-bar-height)) !important;
}

/* Character Badge */
.hud-char-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.hud-char-name {
  font-weight: 700;
  color: #f7fafc;
  letter-spacing: 0.3px;
}

.hud-char-badge {
  background: #2b3544;
  color: #63b3ed;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: 1px solid #4a5568;
}

/* Stat Meters Container */
.hud-meters {
  display: flex;
  align-items: center;
  gap: 24px;
}

.hud-meter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-meter-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.hud-hp .hud-meter-label { color: #fc8181; }
.hud-mp .hud-meter-label { color: #63b3ed; }
.hud-xp .hud-meter-label { color: #f6e05e; }

.hud-meter-value {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e0;
  min-width: 75px;
  font-variant-numeric: tabular-nums;
  font-family: monospace, sans-serif;
}

/* Semantic <progress> Styling */
progress.hud-progress {
  appearance: none;
  -webkit-appearance: none;
  border: 0 solid transparent;
  overflow: clip;
  height: 13px;
  width: 130px;
  border-radius: 6px;
  background: #10141d;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
  vertical-align: middle;
}

progress.hud-progress::-webkit-progress-bar {
  background: transparent;
}

/* HP Progress Fill */
progress.hud-hp-progress::-webkit-progress-value {
  background: linear-gradient(90deg, #9b2c2c, #e53e3e);
  border-radius: 6px;
  transition: width 0.3s ease;
}
progress.hud-hp-progress::-moz-progress-bar {
  background: linear-gradient(90deg, #9b2c2c, #e53e3e);
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* MP Progress Fill */
progress.hud-mp-progress::-webkit-progress-value {
  background: linear-gradient(90deg, #2b6cb0, #4299e1);
  border-radius: 6px;
  transition: width 0.3s ease;
}
progress.hud-mp-progress::-moz-progress-bar {
  background: linear-gradient(90deg, #2b6cb0, #4299e1);
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* XP Progress Fill */
progress.hud-xp-progress::-webkit-progress-value {
  background: linear-gradient(90deg, #b7791f, #ecc94b);
  border-radius: 6px;
  transition: width 0.3s ease;
}
progress.hud-xp-progress::-moz-progress-bar {
  background: linear-gradient(90deg, #b7791f, #ecc94b);
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* Gold / Coins Widget */
.hud-coins {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #faf089;
  min-width: 90px;
  justify-content: flex-end;
}

/* Multi-Denomination Currency Badges */
.coin-display {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.coin-badge {
  display: inline-flex;
  align-items: baseline;
  font-weight: 700;
  font-size: 12px;
}

.coin-badge-g {
  color: #ecc94b;
  text-shadow: 0 0 6px rgba(236, 201, 75, 0.4);
}

.coin-badge-s {
  color: #e2e8f0;
  text-shadow: 0 0 4px rgba(226, 232, 240, 0.3);
}

.coin-badge-c {
  color: #ed8936;
  text-shadow: 0 0 4px rgba(237, 137, 54, 0.3);
}

.sidebar-pouch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(13, 17, 23, 0.85);
  border-top: 1px solid #2d3748;
  font-size: 12px;
  font-weight: 600;
  color: #a0aec0;
}

/* =====================================================================
 * Eldoria Bottom Bar: Room Telemetry HUD & Single-Line Input
 * ===================================================================== */

#eldoria-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--bottom-bar-height);
  background: rgba(15, 18, 24, 0.98);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid #2d3748;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 16px 6px 16px;
  z-index: 10000;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 12px;
  color: #e2e8f0;
  user-select: none;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.6);
}

.room-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 24px;
  gap: 12px;
  border-bottom: 1px solid rgba(45, 55, 72, 0.6);
  padding-bottom: 3px;
  min-width: 0;
}

.room-hud-left,
.room-hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
}

.room-hud-pin {
  font-size: 13px;
  flex-shrink: 0;
}

.room-hud-name {
  font-weight: 700;
  color: #f7fafc;
  font-size: 13px;
  letter-spacing: 0.2px;
  text-overflow: ellipsis;
  overflow: hidden;
}

.room-hud-badge {
  background: #2b3544;
  color: #68d391;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid #4a5568;
  flex-shrink: 0;
}

.room-hud-badge.terrain {
  color: #cbd5e0;
  background: #1a202c;
}

.room-hud-coord {
  font-family: monospace, sans-serif;
  font-size: 11px;
  color: #a0aec0;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.room-hud-exits-label {
  font-size: 11px;
  color: #a0aec0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.room-hud-exits {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.room-exit-btn {
  background: #1e2638;
  color: #63b3ed;
  border: 1px solid #3b4a63;
  border-radius: 3px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  line-height: 18px;
  height: 18px;
  transition: all 0.15s ease;
}

.room-exit-btn:hover {
  background: #2b3a55;
  color: #fff;
  border-color: #63b3ed;
  transform: translateY(-1px);
}

.room-no-exits {
  color: #718096;
  font-size: 11px;
}

.room-hud-env {
  font-size: 11px;
  color: #faf089;
  font-weight: 500;
  margin-left: 6px;
  flex-shrink: 0;
}

/* Single-Line Input Controls */
.input-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
}

.input-prompt {
  color: #63b3ed;
  font-family: monospace, sans-serif;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

#inputfield.form-control {
  flex: 1;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  padding: 3px 10px;
  background: #0d1117 !important;
  color: #f0f6fc !important;
  border: 1px solid #30363d !important;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'DejaVu Sans Mono', Consolas, Inconsolata, 'Lucida Console', monospace;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
  line-height: 24px;
}

#inputfield.form-control:focus {
  border-color: #58a6ff !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.25) !important;
}

#eldoria-bottom-bar #inputsend,
.input-hud #inputsend,
#inputsend.inputsend {
  position: static !important;
  height: 30px !important;
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 14px;
  font-weight: 700;
  background: #238636 !important;
  color: #fff !important;
  border: 1px solid #2ea043 !important;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 30px;
  transition: background 0.15s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

#eldoria-bottom-bar #inputsend:hover,
.input-hud #inputsend:hover,
#inputsend.inputsend:hover {
  background: #2ea043 !important;
}

/* Suppress redundant input elements inside GoldenLayout panes if present */
.lm_stack:has(.inputfieldwrapper),
.lm_stack:has(.inputwrap),
.lm_item:has(.inputfieldwrapper),
.lm_splitter:has(+ .lm_stack:has(.inputwrap)) {
  display: none !important;
}

/* =====================================================================
 * Eldoria Right Sidebar: Equipment & Inventory List
 * ===================================================================== */

.hud-sidebar-toggle {
  background: #2b3544;
  color: #63b3ed;
  border: 1px solid #4a5568;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  user-select: none;
}

.hud-sidebar-toggle:hover {
  background: #3b4a63;
  color: #fff;
  border-color: #63b3ed;
}

.hud-sidebar-toggle.active {
  background: #1e3a5f;
  color: #90cdf4;
  border-color: #3182ce;
}

#sidebar-hud {
  position: fixed;
  top: var(--hud-height);
  bottom: var(--bottom-bar-height);
  right: 0;
  width: var(--sidebar-width);
  background: rgba(15, 18, 24, 0.98);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-left: 1px solid #2d3748;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: #e2e8f0;
  user-select: none;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

#sidebar-hud.collapsed {
  transform: translateX(100%);
  pointer-events: none;
  opacity: 0;
}

body.has-sidebar #clientwrapper #main {
  width: calc(100% - var(--sidebar-width)) !important;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #2d3748;
  background: rgba(22, 27, 34, 0.95);
  flex-shrink: 0;
}

.sidebar-title {
  font-weight: 700;
  font-size: 12px;
  color: #f7fafc;
  letter-spacing: 0.3px;
}

.sidebar-close-btn {
  background: transparent;
  border: none;
  color: #a0aec0;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.sidebar-close-btn:hover {
  color: #fff;
  background: #2d3748;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #a0aec0;
  border-bottom: 1px solid #283141;
  padding-bottom: 4px;
}

.inv-count-badge {
  font-size: 10px;
  color: #63b3ed;
  font-weight: 600;
  text-transform: none;
}

.equipment-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.equipment-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #141820;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid #222a38;
  font-size: 11px;
}

.slot-name {
  color: #718096;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  width: 55px;
  flex-shrink: 0;
}

.slot-item {
  font-weight: 600;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  text-align: right;
  flex: 1;
}

.slot-item.equipped {
  color: #68d391;
}

.slot-item.empty {
  color: #4a5568;
  font-style: italic;
}

.inventory-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inv-empty-msg {
  color: #718096;
  font-size: 11px;
  font-style: italic;
  padding: 6px 4px;
}

.inv-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #141820;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid #222a38;
  font-size: 11px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.inv-item:hover {
  border-color: #3b4a63;
  background: #1c2230;
}

.item-icon {
  font-size: 12px;
  flex-shrink: 0;
}

.item-name {
  flex: 1;
  font-weight: 500;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-action {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 3px;
  background: #2b3544;
  color: #63b3ed;
  cursor: pointer;
  border: 1px solid #3b4a63;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.item-action:hover {
  background: #3b4a63;
  color: #fff;
  border-color: #63b3ed;
}

@media (max-width: 768px) {
  .room-hud-coord,
  .room-hud-badge.terrain {
    display: none !important;
  }
  .hud-meters {
    gap: 12px;
  }
}
