/* Main Loadout Layout */
.loadout-container {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.slot-section {
  margin-bottom: 15px;
}

.slot-header {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.slot-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

/* Inventory Icons (Right, 3x3 Grid) */
.inventory-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  gap: 4px;
}

/* Stacked Content Layout */
.loadout-container.stacked {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.loadout-section {
  background-color: var(--card-bg);
  /* Use variable */
  padding: 10px;
  width: 100%;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-color);
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 15px;
  padding-bottom: 5px;
}

/* Character List Container - Accordion Style */
.character-list {
  display: flex;
  gap: 5px;
  align-items: center;
  background: var(--card-bg);
  padding: 8px;
  /* Increased from 5px to prevent border cutoff */
  border-radius: 6px;
  z-index: 5;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

/* Character & Loadout Wrapper */
.char-loadout-wrapper {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  gap: 20px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

/* Character Card - Rectangular design 160x80 */
.character-card {
  width: 160px;
  height: 80px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border-color);
  cursor: pointer;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.character-card.active {
  border: 2px solid var(--accent-color);
  transform: scale(1.02);
  box-shadow: 0 0 10px var(--accent-color);
}

.character-card:hover:not(.active) {
  border-color: var(--hover-border);
  transform: translateY(-2px);
}

/* Overlay for Text readability */
.char-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.3));
  z-index: 1;
}

.char-details {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  text-shadow: 1px 1px 3px #000;
  width: 100%;
}

.char-class {
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 5px;
}

.char-light {
  font-size: 1.2rem;
  font-weight: 700;
  color: #eec900;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* --- In-Game Loadout Grid (Right Side) --- */
.loadout-grid-container {
  display: flex;
  align-items: center;
  margin-left: 20px;
  z-index: 10;
}

.ingame-loadout-grid {
  display: grid;
  grid-template-columns: repeat(6, 40px);
  /* 2 rows of 6 */
  gap: 6px;
}

.ingame-loadout-grid.hidden {
  display: none;
}

/* Loadout Slots with Color */
.loadout-slot {
  width: 40px;
  height: 40px;
  background: var(--slot-bg);
  border: 1px solid var(--slot-border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  /* For color bg */
}

.loadout-color-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  opacity: 0.3;
  /* Subtle color tint behind icon */
  z-index: 1;
}

.loadout-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  position: relative;
  z-index: 2;
  /* Content above color */
}

.populated {
  border: 1px solid #666;
}

.loadout-placeholder {
  color: var(--text-color);
  font-size: 1.0rem;
  font-weight: bold;
  position: relative;
  z-index: 5;
  text-shadow: 0 0 2px #000;
  /* Ensure visible on color */
}

.empty-loadout {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--slot-border);
}

/* --- Artifact Grid 6x2 --- */
.artifact-section {
  margin-top: 10px;
  background: var(--card-bg);
  padding: 8px;
  border-radius: 4px;
}

.artifact-grid {
  display: grid;
  grid-template-columns: repeat(5, 40px);
  /* 5x3 layout */
  grid-template-rows: repeat(3, 40px);
  gap: 4px;
}

.artifact-perk {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  background: #222;
  /* Always dark for visibility of cyan icons */
  border-radius: 20px;
  /* Circular icons */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.artifact-perk img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artifact-perk.empty {
  border: 1px dashed var(--slot-border);
  opacity: 0.3;
}

/* User Profile & Controls */
.loadout-grid-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--card-bg);
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  max-width: 100%;
}

.user-name {
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  overflow: hidden;
  text-overflow: ellipsis;
}

.loadout-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  padding: 5px 10px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.8rem;
  background: var(--accent-color);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #000;
  font-weight: bold;
}

/* Settings Overlay */
.loadout-slot {
  position: relative;
}

.loadout-settings-overlay {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 2px;
  font-size: 12px;
  border-bottom-left-radius: 4px;
  cursor: pointer;
  display: none;
  z-index: 10;
}

.loadout-slot:hover .loadout-settings-overlay {
  display: block;
}

.loadout-slot.selected {
  border: 2px solid var(--accent-color);
}

/* Vault Grid */
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 4px;
  padding: 10px;
}

.vault-grid .item-slot {
  width: 48px;
  /* height auto is default from _item_slot.css */
}

/* --- Dashboard 3-Column Layout --- */
.main-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 40px;
  /* Increased and clarified as column-gap */
  row-gap: 20px;
  width: 100%;
  margin-top: 10px;
  align-items: flex-start;
}

/* For mobile, stack columns */
@media (max-width: 1024px) {
  .main-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.layout-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  /* Prevent flex children from overflowing */
}

/* .col-title removed as it's replaced by .section-title */


.placeholder-col {
  background: var(--card-bg);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

/* Loadout Detail Content Styling */
.loadout-detail-view {
  background: var(--card-bg);
  padding: 15px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-row-title {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.detail-item-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* detail-item-icon removed as it's replaced by standard .item-slot */


/* exotic border is handled by item-slot's internal logic or can be added to detail view if needed */


.detail-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detail-stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 10px;
  border-radius: 4px;
}

.detail-stat-icon {
  width: 18px;
  height: 18px;
}

.detail-stat-value {
  font-weight: 700;
  font-size: 1.1rem;
}

.detail-stat-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
/* Loadout Index Overlay */
.loadout-index-overlay {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
    z-index: 5;
    text-shadow: 1px 1px 2px black;
    pointer-events: none;
}

/* Center Loadout Grid */
.loadout-grid-container {
    display: flex;
    justify-content: center;
    width: 100%;
}
