/* === APP LAYOUT (sidebar + main) === */
.app-layout {
  display: grid;
  grid-template-columns: 0px 1fr;
  min-height: calc(100vh - 48px);
  /* NOTE: grid-template-columns transitions can cause layout thrashing on
     older browsers. If janky, remove this transition or animate sidebar
     width instead. */
  transition: grid-template-columns 0.2s ease;
}

.app-layout.sidebar-open {
  grid-template-columns: 340px 1fr;
}

/* === SIDEBAR === */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - 48px);
  position: sticky;
  top: 48px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.sidebar-open .sidebar {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-header {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.sidebar-header h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem;
  line-height: 1;
}

.sidebar-close:hover { color: var(--text-primary); }

.sidebar-loading {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.sidebar-error {
  padding: 1rem;
  text-align: center;
  color: var(--accent-negative);
  font-size: 0.85rem;
}

/* === GEAR COMPACT TABLE (sidebar) === */
.gear-compact table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.gear-compact th {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.5rem;
  text-align: left;
}

.gear-compact td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--bg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.gear-compact tr:hover td { background: rgba(255, 255, 255, 0.03); }

.gear-compact .slot-name {
  color: var(--text-muted);
  font-size: 0.65rem;
  text-transform: uppercase;
}

.bis-tag {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--text-dim);
  font-size: 0.6rem;
  padding: 0.05rem 0.25rem;
  border-radius: 2px;
  font-weight: bold;
}

.bis-tag.bis-yes {
  color: var(--accent-uncommon);
  background: rgba(30, 255, 0, 0.1);
}

/* === SIDEBAR RESPONSIVE === */
@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr !important; }
  .app-layout.sidebar-open .sidebar {
    height: auto;
    max-height: 50vh;
    position: relative;
    top: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
