/* ================================
   Global Variables - Use main styles.css variables
================================ */

/* ================================
   Main Sections
================================ */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

section {
  margin-bottom: 2.5rem;
}

/* ================================
   INVENTORY - Forced Grid (Experts Only)
================================ */
#inventory {
  /* Override the global flex-column/center layout */
  display: block !important; 
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#inventory h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  width: 100%;
}

.inventory-grid {
  /* This creates 3 columns of equal width. 
     You can change '3' to '4' or '5' if you want more on one line */
  display: grid !important;
  grid-template-columns: repeat(3, 1fr); 
  gap: 1.5rem;
  width: 100%;
}

#inventory .input-group {
  /* Ensures the individual groups don't shrink or center-align strangely */
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  width: 100% !important;
}

#inventory input {
  /* Forces the input to take up the space of the grid column */
  width: 100% !important;
  max-width: 200px; 
  box-sizing: border-box;
}

/* Mobile Responsive: Switch to 1 column on small screens */
@media (max-width: 768px) {
  .inventory-grid {
    grid-template-columns: 1fr;
  }
}

/* ================================
   EXPERT HEROES - Grid Layout
================================ */
#expert-heroes {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

.expert-hero-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  justify-content: center;
}

.hero-piece {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid var(--border);
}

.hero-piece:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.hero-image {
  width: 120px;
  height: 120px;
  margin-bottom: 1rem;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero-piece h3 {
  font-size: 1.3rem;
  margin: 0.5rem 0 1rem;
  color: var(--text);
}

.gear-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 280px;
  font-weight: bold;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.gear-slot {
  display: flex;
  gap: 1rem;
  width: 100%;
  max-width: 280px;
  justify-content: space-between;
}

.gear-slot select {
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: 6px;
  background: var(--select-bg);
  color: var(--text);
  border: 1px solid var(--border);
  width: 45%;
}

/* Skill Section */
.skill-section {
  display: block !important;
  margin-top: 1.2rem;
  padding: 1rem;
  background: var(--slot-bg);
  border-radius: 10px;
  border: 1px dashed var(--border);
  width: 100%;
  max-width: 320px;
}

.skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}

.skill-name {
  flex: 1;
  text-align: left;
}

.skill-current,
.skill-desired {
  width: 60px;
  text-align: center;
}

/* ================================
   FIX: Expert Level Select Visibility
================================ */

/* Targets the dropdowns inside the expert hero cards */
.gear-slot select, 
.skill-row select {
    background-color: var(--select-bg) !important;
    color: var(--text) !important; /* Forces the text to follow the theme color */
    border: 1px solid var(--border);
}

/* Specifically ensures that the "Options" inside the dropdown are visible */
.gear-slot select option,
.skill-row select option {
    background-color: var(--card-bg); /* Matches the card background */
    color: var(--text);            /* Matches the theme text color */
}

/* Light Mode specific override to ensure black text on white backgrounds */
body:not([data-theme="dark"]) .gear-slot select,
body:not([data-theme="dark"]) .skill-row select {
    color: #1e293b !important; /* Dark slate text for visibility */
    background-color: #ffffff !important;
}

/* ================================
   TOTALS - Compact Grid
================================ */
#totals {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

#totals h2 {
  text-align: center;
  margin-bottom: 1.2rem;
}

.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}

.total-item {
  background: var(--slot-bg);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  border: 1px solid var(--border);
}

.total-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 0.8rem;
}

.total-item strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.total-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary);
  margin: 0.3rem 0;
}

.gap-message {
  font-size: 0.95rem;
  min-height: 1.4em;
}

/* General Sigils warning style */
.general-sigils .gap-message.warning {
  color: #fbbf24;
  font-weight: bold;
}



/* ================================
   Responsive Adjustments
================================ */
@media (max-width: 900px) {
  .expert-hero-container {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  main {
    padding: 0.8rem;
  }

  .inventory-grid,
  .totals-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .input-group input,
  .gear-slot select {
    font-size: 0.95rem;
    padding: 0.5rem;
  }

  .hero-image {
    width: 100px;
    height: 100px;
  }

  .skill-section {
    padding: 0.8rem;
  }

  .skill-row {
    font-size: 0.9rem;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .hero-piece h3 {
    font-size: 1.1rem;
  }

  .gear-header,
  .gear-slot {
    font-size: 0.9rem;
  }
}