/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */


/* Leader Section Base Styles */
.leader-section {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--color-accent-bg);
  border-radius: 0.5rem;
  border-left: 3px solid var(--color-accent);
  transition: all 0.15s ease;
}

.leader-section h4 {
  color: var(--color-accent);
  font-weight: bold;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

/* Compact Mode: Transform into clickable badge */
html.keywords-compact .leader-section {
  display: inline-flex !important;
  width: auto !important;
  margin-top: 0.5rem !important;
  padding: 0.125rem 0.5rem !important;
  background: var(--color-bg-card-hover) !important;
  border: 1px solid transparent !important;
  border-radius: 0.25rem !important;
  cursor: pointer;
}

html.keywords-compact .leader-section:hover {
  background-color: var(--color-bg-card) !important;
  border-color: var(--color-accent) !important;
}

html.keywords-compact .leader-section h4 {
  margin: 0 !important;
  font-size: 0.7rem !important;
  color: var(--color-text-primary) !important;
}

html.keywords-compact .leader-section ul {
  display: none !important;
}

/* =========================================
   Wahapedia Rich Text Styles
   ========================================= */
.wahapedia-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  border: 1px solid var(--color-border);
}

.wahapedia-text th,
.wahapedia-text td {
  border: 1px solid var(--color-border);
  padding: 0.5rem;
  text-align: left;
  vertical-align: top;
}

.wahapedia-text th {
  background-color: var(--color-accent-bg);
  color: var(--color-accent);
  font-weight: bold;
}

.wahapedia-text .kwb {
  font-weight: bold;
  color: var(--color-text-primary);
}

.wahapedia-text [class^="tooltip"] {
  border-bottom: 1px dotted var(--color-text-muted);
  cursor: help;
}

.wahapedia-text strong {
  color: var(--color-text-primary);
}

/* Specific fix for the messy "Psychic Test Sequence" table 
   Wahapedia uses nested tables and inline styles. 
   We try to normalize them slightly. */
.wahapedia-text table table {
  margin: 0;
  border: none;
}

/* Fix popover scrolling */
#keyword-popover .keyword-popover-content {
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* =========================================
   Wahapedia Sub-Ability Formatting
   ========================================= */

/* Custom Headers (CONTAGION RANGE, AFFLICTED, etc.) */
.wahapedia-text .hi_custom {
  display: block;
  font-weight: bold;
  font-size: 0.875rem;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1rem 0 0.5rem 0;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--color-border);
}

/* Dread Abilities / Stratagem-style Boxes */
.wahapedia-text .stratWrapper_CS {
  background: var(--color-bg-card-hover);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: 0.375rem;
  margin: 0.75rem 0;
  overflow: hidden;
}

.wahapedia-text .stratName_CS {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem 0.75rem;
  font-weight: bold;
  color: var(--color-text-primary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wahapedia-text .stratText_CS {
  padding: 0.5rem 0.75rem;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* D6 dice icons used for ability markers */
.wahapedia-text .cruD6wrap {
  display: inline-flex;
  align-items: center;
  background: var(--color-accent);
  color: var(--color-bg-card);
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: bold;
  font-size: 0.75rem;
}

.wahapedia-text [class^="cruD"] {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Impact Headers (used in formatted tables) */
.wahapedia-text .impact18 {
  font-weight: bold;
  font-size: 1rem;
  color: var(--color-text-primary);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

/* Example/Designer Note boxes */
.wahapedia-text .redExample {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--color-danger);
  padding: 0.75rem;
  margin: 0.75rem 0;
  font-size: 0.875rem;
  font-style: italic;
  border-radius: 0 0.25rem 0.25rem 0;
}

/* Lists inside wahapedia content */
.wahapedia-text ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.wahapedia-text li {
  margin: 0.25rem 0;
}

/* Column layout */
.wahapedia-text .Columns2 {
  column-count: 1;
}

@media (min-width: 768px) {
  .wahapedia-text .Columns2 {
    column-count: 2;
    column-gap: 2rem;
  }
}

/* Dice number replacement (for Chaos Knights, World Eaters, etc.) */
.wahapedia-text .dice-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--color-accent);
  color: var(--color-bg-card);
  font-weight: bold;
  font-size: 0.875rem;
  border-radius: 0.25rem;
  margin: 0 0.125rem;
}

.wahapedia-text .dice-op {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  color: var(--color-text-muted);
  font-weight: bold;
  font-size: 0.75rem;
  text-transform: uppercase;
}