/* ====================================================
   HINOAKE — panels.css
   Side panels: Upgrades, Quests, Achievements, Inventory
   ==================================================== */

/* ===== SIDE PANEL BASE ===== */
.side-panel {
  position: fixed;
  top: 0; right: 0;
  width: var(--panel-w, 340px);
  height: 100vh;
  background: var(--color-panel);
  border-left: 2px solid var(--color-border);
  z-index: 40;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}
.side-panel.open { transform: translateX(0); }
.side-panel.hidden { display: none; }

.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: var(--color-panel2);
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  flex-shrink: 0;
}
.panel-close {
  background: none; border: none;
  color: var(--color-text-dim); cursor: pointer;
  font-size: 16px; line-height: 1;
  padding: 0 4px;
  transition: color var(--transition);
}
.panel-close:hover { color: var(--color-red); }

.panel-tabs {
  display: flex; flex-shrink: 0;
  border-bottom: 1px solid var(--color-border);
}
.tab-btn {
  flex: 1; padding: 8px;
  background: none; border: none;
  color: var(--color-text-dim);
  font-family: var(--pixel-font);
  font-size: 9px; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.tab-btn.active { color: var(--color-gold); border-bottom-color: var(--color-gold); }
.tab-btn:hover  { color: var(--color-text); }

.panel-body {
  flex: 1; overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}

/* ===== UPGRADE ROWS ===== */
.upgrade-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--color-panel2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color var(--transition);
}
.upgrade-row:hover { border-color: var(--color-gold2); }

.upgrade-icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
}
.upgrade-icon img {
  width: 100%; height: 100%;
  image-rendering: pixelated;
  display: block;
}
.upgrade-info { flex: 1; }
.upgrade-name  { font-size: 10px; color: var(--color-text); }
.upgrade-desc  { font-size: 8px;  color: var(--color-text-dim); margin-top: 2px; }
.upgrade-level { font-size: 8px;  color: var(--color-blue); margin-top: 2px; }

.btn-upgrade {
  font-family: var(--pixel-font);
  padding: 6px 10px; font-size: 9px;
  background: var(--color-gold2); border: 1px solid var(--color-gold);
  border-radius: var(--radius); cursor: pointer; color: #000;
  white-space: nowrap;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-upgrade:hover   { background: var(--color-gold); }
.btn-upgrade:disabled { opacity: 0.35; cursor: not-allowed; }

/* ===== QUEST ROWS ===== */
.quest-row {
  background: var(--color-panel2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color var(--transition);
}
.quest-row.completed { border-color: var(--color-green); opacity: 0.7; }
.quest-row.claimable { border-color: var(--color-gold); }

.quest-name  { font-size: 10px; color: var(--color-text); margin-bottom: 4px; }
.quest-desc  { font-size: 8px;  color: var(--color-text-dim); margin-bottom: 6px; line-height: 1.5; }

.quest-progress {
  height: 8px; background: rgba(0,0,0,0.4);
  border: 1px solid var(--color-border);
  border-radius: 2px; overflow: hidden; margin-bottom: 6px;
}
.quest-progress-bar {
  height: 100%; background: var(--color-blue);
  transition: width 0.5s ease;
}
.quest-bar-fill {
  height: 100%;
  background: linear-gradient(to right, #2a8a3a, #3ecf5a);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.quest-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 8px;
}
.quest-reward { color: var(--color-gold); }
.btn-claim {
  font-family: var(--pixel-font); padding: 4px 10px; font-size: 8px;
  background: var(--color-green); border: 1px solid #2aaa40;
  border-radius: var(--radius); cursor: pointer; color: #000;
}
.btn-claim:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== ACHIEVEMENT ROWS ===== */
.ach-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--color-panel2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.ach-row.unlocked { border-color: var(--color-gold); }
.ach-row.locked   { opacity: 0.5; }

.ach-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  font-size: 20px; text-align: center;
}
.ach-info { flex: 1; }
.ach-name   { font-size: 10px; color: var(--color-text); }
.ach-desc   { font-size: 8px;  color: var(--color-text-dim); margin-top: 2px; }
.ach-reward { font-size: 8px;  color: var(--color-gold); margin-top: 2px; }
.ach-check  { font-size: 18px; flex-shrink: 0; }

/* ===== INVENTORY GRID ===== */
#inventory-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.inv-cell {
  aspect-ratio: 1;
  background: var(--color-panel2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition);
  position: relative;
}
.inv-cell:hover { border-color: var(--color-gold2); }
.inv-cell img { width: 70%; image-rendering: pixelated; }
.inv-cell .inv-qty {
  position: absolute; bottom: 2px; right: 3px;
  font-size: 7px; color: var(--color-gold);
  text-shadow: 1px 1px 0 #000;
}

/* ===== BOSS HP BAR (in-game) ===== */
#boss-bar-wrap {
  position: absolute;
  top: 60px; left: 50%;
  transform: translateX(-50%);
  width: min(400px, 80vw);
  z-index: 12;
  pointer-events: none;
}
#boss-bar-name {
  text-align: center; font-size: 11px;
  color: var(--color-red); margin-bottom: 4px;
}
#boss-hp-bar-outer {
  height: 16px; background: rgba(0,0,0,0.6);
  border: 2px solid var(--color-red);
  border-radius: 2px; overflow: hidden;
}
#boss-hp-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #7a0000, var(--color-red));
  transition: width 0.4s ease;
}

/* ===== PANEL BACKDROP ===== */
.panel-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 35;
  display: none;
}
.panel-backdrop.active { display: block; }

/* Desktop: no backdrop needed — panel slides from right edge */
@media (min-width: 601px) {
  .panel-backdrop { display: none !important; }
}

@media (max-width: 600px) {
  .side-panel { width: 100vw; border-left: none; }
}
