/* ============================================================
   LAYOUT — Game screen: header, sidebar, main content, inventory panel
   ============================================================ */

/* Screens - top level views */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ---- HEADER ---- */
#game-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 52px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 50;
}

#game-logo {
  font-size: 19px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: .5px;
  text-shadow: 0 0 24px rgba(88,166,255,.35);
  white-space: nowrap;
}

.header-char-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
}
.header-char-info .char-name { font-weight: 700; color: var(--gold); }
.header-char-info .char-class { font-size: 11px; color: var(--text-muted); }

.header-stats {
  display: flex;
  gap: 10px;
  align-items: center;
}
.stat-badge {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  white-space: nowrap;
}
.stat-badge .val { font-weight: 700; color: var(--gold); }

.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
#save-indicator {
  font-size: 12px;
  color: var(--success);
  opacity: 0;
  transition: opacity .4s;
}

/* ---- GAME BODY ---- */
#game-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ---- SIDEBAR ---- */
#sidebar {
  width: 162px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  padding-bottom: 12px;
}

.sidebar-section { padding: 8px 0 2px; }

.sidebar-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 6px 14px 3px;
  font-weight: 600;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: .15s;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}
.nav-btn:hover  { background: var(--card); color: var(--text); }
.nav-btn.active { background: var(--card); color: var(--accent); border-left-color: var(--accent); }

.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-level {
  font-size: 11px;
  font-weight: 700;
  background: var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
}
.nav-btn.active .nav-level { background: var(--accent-dim); color: var(--accent); }

/* ---- MAIN CONTENT ---- */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}

/* Page visibility */
.page { display: none; }
.page.active { display: block; }

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-title .icon { font-size: 26px; }

/* ---- INVENTORY PANEL ---- */
#inv-panel {
  width: 218px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.inv-panel-header {
  padding: 12px 14px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  letter-spacing: .3px;
}

/* Equipment slots */
#equipment-area {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.equip-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.equip-slots {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
}
.equip-slot {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px 3px;
  text-align: center;
  cursor: pointer;
  transition: .15s;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.equip-slot:hover { border-color: var(--danger); }
.equip-slot.filled { border-color: var(--accent-dim); }
.equip-slot .es-icon { font-size: 18px; opacity: .35; }
.equip-slot.filled .es-icon { opacity: 1; }
.equip-slot .es-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.equip-slot .es-name { font-size: 9px; color: var(--accent); font-weight: 700; line-height: 1.2; max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Inventory item list */
#inv-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
}
.inv-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: .12s;
}
.inv-item:hover { background: var(--card); }
.inv-item .ii-icon { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.inv-item .ii-name { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-item .ii-qty  { font-size: 11px; font-weight: 700; color: var(--text-muted); min-width: 30px; text-align: right; }
.inv-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 20px 0; }

/* ---- NOTIFICATIONS ---- */
#notif-wrap {
  position: fixed;
  bottom: 20px;
  right: 230px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 600;
  pointer-events: none;
}
.notif {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 9px 14px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: notifIn .25s ease;
  max-width: 280px;
  pointer-events: none;
}
.notif.level-up  { border-color: var(--gold); color: var(--gold); font-weight: 700; }
.notif.reward    { border-color: var(--success); }
.notif.bad       { border-color: var(--danger); }
@keyframes notifIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
