/*  DASHBOARD THEME ISOLATION */
.dashboard-theme {
  --health-color: #ef4444;
  --accent-primary: #a855f7;
  --accent-secondary: #06b6d4;
  --surface: rgba(15, 15, 20, 0.8);
  --font-ui: 'Inter', sans-serif;
  color: #fff;
  font-family: var(--font-ui);
}

.dashboard-theme * {
  box-sizing: border-box;
}

/*  DASHBOARD PHASE 1 STYLES */
.dashboard-selector {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 16px 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  scrollbar-width: thin;
}

.selector-card {
  flex: 0 0 auto;
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.selector-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-4px);
  border-color: var(--accent-primary);
}

.selector-card.active {
  background: rgba(168, 85, 247, 0.15);
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

.selector-portrait {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.selector-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selector-info {
  text-align: center;
}

.selector-name {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
  display: block;
}

.selector-lv {
  font-size: 9px;
  opacity: 0.6;
}

.selector-hp-bar {
  width: 40px;
  height: 3px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  margin-top: 4px;
}

.selector-hp-fill {
  height: 100%;
  background: var(--health-color);
  border-radius: 2px;
}

/* MAIN DASHBOARD LAYOUT */
.dashboard-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.db-portrait-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.db-hero-portrait {
  width: 100%;
  aspect-ratio: 4/5;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
}

.db-hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.db-portrait-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.3s;
  backdrop-filter: blur(4px);
}

.db-hero-portrait:hover .db-portrait-overlay {
  opacity: 1;
}

.db-edit-icon {
  font-size: 32px;
}

.db-edit-text {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.db-hero-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.db-equip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.db-equip-slot {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  transition: all 0.2s;
}

.db-equip-slot:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.db-slot-icon {
  font-size: 20px;
  opacity: 0.8;
}

.db-slot-label {
  font-size: 9px;
  text-transform: uppercase;
  opacity: 0.5;
  letter-spacing: 1px;
}

.db-item-name {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.db-unequip-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 0, 0, 0.2);
  color: white;
  border: none;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.db-equip-slot:hover .db-unequip-btn {
  opacity: 1;
}

.db-stats-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.db-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.db-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), transparent);
}

/* STAT BARS */
.db-stat-bar-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.db-stat-row {
  display: grid;
  grid-template-columns: 80px 1fr 40px;
  align-items: center;
  gap: 12px;
}

.db-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.db-bar-outer {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.db-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.db-stat-value {
  font-size: 13px;
  font-family: monospace;
  text-align: right;
}

.db-stat-bonus {
  color: #f59e0b;
  font-size: 10px;
  margin-left: 2px;
}

/* COMBAT GRID */
.db-combat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.db-combat-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ACTION BAR */
.dashboard-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.db-action-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

@media (max-width: 800px) {
  .dashboard-container {
    grid-template-columns: 1fr;
  }
}

/* PHASE 2: COLLAPSIBLE BAG DRAWER */
.db-bag-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60vh;
  max-height: 535px;
  background: rgba(15, 15, 20, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(168, 85, 247, 0.3);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-radius: 24px 24px 0 0;
}

.db-bag-drawer.open {
  transform: translateY(0);
}

.db-bag-drawer-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.db-bag-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* BIOGRAPHY SECTION */
.db-bio-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.db-bio-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.db-bio-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #a855f7;
  opacity: 0.9;
}

.db-bio-val {
  font-size: 13px;
  font-weight: 500;
}

.db-bio-capitalize {
  text-transform: capitalize;
}

.db-bio-text {
  margin-top: 12px;
}

.db-bio-label-block {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #a855f7;
  margin-bottom: 6px;
  opacity: 0.9;
}

.db-bio-paragraph {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border-left: 2px solid rgba(168, 85, 247, 0.3);
  font-style: italic;
}

.db-section {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 20px;
}

/* RICH EQUIPMENT TOOLTIPS */

.db-item-tooltip {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  width: 200px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5),
    0 8px 10px -6px rgba(0, 0, 0, 0.5);
  text-align: left;
}

/* Position adjustment for upper slots to prevent cutoff */
.db-equip-slot:nth-child(1) .db-item-tooltip,
.db-equip-slot:nth-child(2) .db-item-tooltip,
.db-equip-slot:nth-child(3) .db-item-tooltip {
  bottom: auto;
  top: 100%;
  margin-top: 10px;
}

/* Position adjustment for lower slots */
.db-equip-slot:nth-child(4) .db-item-tooltip,
.db-equip-slot:nth-child(5) .db-item-tooltip,
.db-equip-slot:nth-child(6) .db-item-tooltip {
  bottom: 100%;
  top: auto;
  margin-bottom: 10px;
}

.db-equip-slot:hover .db-item-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.db-tt-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.db-tt-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}

.db-tt-meta {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}

.db-tt-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.db-tt-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.db-tt-stat-label {
  opacity: 0.7;
}

.db-tt-stat-val {
  font-family: monospace;
  font-weight: 600;
}

.db-tt-affixes,
.db-tt-tradeoffs {
  font-size: 11px;
  line-height: 1.4;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.db-tt-affixes .affix-inline {
  display: block;
  margin-bottom: 2px;
}

.db-tt-tradeoffs {
  color: #fb7185;
}

/* AFFECTION TIER */
.db-affection-tier {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 6px;
}

/* RELATIONSHIP META CHIPS */
.db-relationship-meta {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.db-meta-chip {
  font-size: 11px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  opacity: 0.8;
}

.db-meta-corrupt {
  background: rgba(139, 0, 0, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fb7185;
}

/* COMPANION QUIRK BADGES */
.db-quirk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.db-quirk-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid;
  transition: all 0.2s;
}

.db-quirk-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.db-quirk-pos {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
}

.db-quirk-neg {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

.db-quirk-icon {
  font-size: 8px;
  opacity: 0.7;
}

.db-quirk-pos .db-quirk-icon {
  color: #22c55e;
}

.db-quirk-neg .db-quirk-icon {
  color: #ef4444;
}

.db-quirk-label {
  flex: 1;
  font-weight: 500;
}

.db-quirk-val {
  font-family: monospace;
  font-weight: 700;
  font-size: 11px;
}

.db-quirk-neg .db-quirk-val {
  color: #ef4444;
}