/**
 * Builder UI Chrome v7.6.4
 * Extracted from team-builder.css (Sprint 4)
 *
 * Summary panel, stats bar, tier tracker.
 *
 * Depends on: builder-core.css
 */

/* ========================================================
   SUMMARY PANEL (Desktop)
   ======================================================== */
.builder-summary {
  display: none;
}

@media (min-width: 900px) {
  .builder-summary {
    display: block;
    width: 340px;
    flex-shrink: 0;
  }
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  position: sticky;
  top: 80px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.summary-card h3 {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-primary);
  margin: 0 0 1.25rem;
  font-size: 1.1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--gold-600);
}

.summary-card h3 i {
  color: var(--gold-600);
  font-size: 1.25rem;
}

.summary-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-muted);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.summary-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.summary-value {
  color: var(--gold-600);
  font-weight: 700;
  font-size: 1rem;
}

.summary-items {
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--border-muted);
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-item-name {
  color: var(--text-primary);
}

.summary-item-qty {
  color: var(--gold-600);
  font-weight: 600;
  background: rgba(184, 154, 87, 0.2);
  padding: var(--space-1) 0.4rem;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
}

.summary-empty {
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
  padding: var(--space-2);
}

.summary-bg-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
  padding: var(--space-2);
  background: rgba(184, 154, 87, 0.1);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold-600);
}

.bg-skills-text {
  color: var(--gold-600);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* Pricing */
.summary-pricing {
  margin-bottom: 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
}

.price-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.price-row.extra {
  color: var(--status-warning);
}

.price-row.extra span:last-child {
  color: var(--status-warning);
  font-weight: 600;
}

.price-row.total {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  border-top: 2px solid var(--gold-600);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.price-row.total span:last-child {
  color: var(--gold-400);
  font-size: 1.35rem;
}

/* Add to Cart Button */



/* ========================================================
   STATS BAR - Fixed to viewport bottom, settles at card bottom
   Styled as part of the outer card frame (gold/purple border)
   ======================================================== */
.stats-bar-wrapper {
  display: none;
  background: url('../../assets/header_footer_bg.png') center / cover no-repeat;
  border-top: none;
  z-index: 100;
  /* Fixed to viewport bottom by default */
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 3rem - 2rem); /* fallback; JS sets exact width */
  max-width: calc(1200px - 2rem);
  /* Match outer card frame */
  border-left: 3px solid var(--gold-700);
  border-right: 3px solid var(--gold-700);
  border-bottom: 3px solid var(--gold-700);
  border-radius: 0 0 12px 12px;
  box-shadow:
    inset 0 0 6px 2px rgba(0, 0, 0, 0.4),
    0 2px 4px 4px rgba(18, 15, 23, 0.8),
    0 0 0 8px var(--purple-900),
    0 0 0 10px var(--gold-700),
    0 6px 20px rgba(0, 0, 0, 0.5);
}

/* Texture overlay to match card background */
.stats-bar-wrapper::before {
  content: none; /* Background image now set on wrapper directly */
}

.stats-bar-wrapper > * {
  position: relative;
  z-index: 1;
}

@media (min-width: 1232px) {
  .stats-bar-wrapper {
    width: calc(1200px - 2rem); /* fallback; JS sets exact width */
  }
}

/* When card bottom is visible, bar settles flush below card */
.stats-bar-wrapper.settled {
  position: relative;
  left: auto;
  transform: none;
  width: 100%;
  max-width: 1200px;
  /* Pull up to overlap card's outset box-shadow frame (purple + gold channels) */
  margin: -18px auto 0; /* 8px purple channel + 10px outer gold = 18px */
  padding-top: 18px; /* Compensate so content doesn't shift up */
  border-radius: 0 0 12px 12px;
  border-top: none;
  box-shadow:
    inset 0 0 6px 2px rgba(0, 0, 0, 0.4),
    0 2px 4px 4px rgba(18, 15, 23, 0.8),
    0 0 0 8px var(--purple-900),
    0 0 0 10px var(--gold-700),
    0 6px 20px rgba(0, 0, 0, 0.5);
}

/* Subtle inner divider across the join — only inside the frame */
.stats-bar-wrapper.settled::after {
  content: '';
  position: absolute;
  top: 18px; /* At the visual join line */
  left: 3px; /* Inset past the gold border */
  right: 3px;
  height: 1px;
  background: var(--gold-700);
  opacity: 0.25;
  z-index: 2;
}

/* Show stats bar in builder stage */
.builder-app.stage-builder .stats-bar-wrapper {
  display: block;
}

.stats-bar-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-4);
  padding: var(--space-2) 1rem;
  flex-wrap: nowrap;
  min-height: 40px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
  white-space: nowrap;
}

.stat-item i {
  color: var(--gold-600);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.stat-item .stat-label {
  color: var(--text-secondary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stat-item .stat-value {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--gold-400);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
}

/* Combined stat format: 32mm / 40mm (total) */
.stat-combined {
  display: flex;
  align-items: center;
  gap: 0;
}

.stat-32mm {
  color: var(--gold-400);
}

.stat-40mm {
  color: rgba(190, 170, 220, 0.95);
}

.stat-separator {
  color: var(--text-secondary);
  font-size: 0.7rem;
  margin: 0 0.15rem;
  font-weight: 400;
}

.stat-total {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.15rem;
}

.stat-remaining {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.35rem;
  opacity: 0.85;
}

/* Skills stat */
.skills-stat {
  flex: 0 0 auto;
}

/* 40mm skills stat - purple accent */
.skills-40mm-stat {
  flex: 0 0 auto;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(128, 90, 213, 0.3);
  margin-left: 0.5rem;
}

.skills-40mm-stat i {
  color: var(--purple-400);
}

.skills-40mm-stat .stat-label {
  color: var(--purple-300);
}

.skills-40mm-stat .stat-value {
  color: var(--purple-400);
}

/* Stat label with small text */
.stat-label small {
  font-size: 0.55rem;
  opacity: 0.7;
  font-weight: 400;
}

/* Price stat */
.price-stat {
  margin-left: auto;
  padding-left: 0.75rem;
}

.price-stat .price-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.price-stat .price-value {
  color: var(--gold-400);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-left: 0.35rem;
}

.price-stat .price-breakdown {
  display: block;
  font-size: 0.65rem;
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-weight: 400;
  margin-left: 0.35rem;
  white-space: nowrap;
}

/* ============================================
   TIER TRACKER - Sliding-scale pricing progress
   Own row above the stats bar inner content.
   Uses flexbox column layout so labels size naturally.
============================================ */
.tier-tracker {
  position: relative;
  padding: 0.5rem 2rem 0.35rem;
  border-bottom: 1px solid rgba(184, 154, 87, 0.2);
}

/* The background rail — spans center of first dot to center of last dot */
.tier-track {
  position: absolute;
  top: calc(0.5rem + 5px); /* Vertically centre on the dot row */
  /* Inset by parent padding + half a flex item width (1/12 of stops width) */
  left: calc(2rem + (100% - 4rem) / 12);
  right: calc(2rem + (100% - 4rem) / 12);
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  z-index: 0;
}

/* Gold fill bar showing current progress */
.tier-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-600), var(--gold-500));
  border-radius: 2px;
  transition: width 0.35s ease;
  box-shadow: 0 0 6px rgba(184, 154, 87, 0.3);
}

/* Container for all the stops — flex row, items spaced evenly */
.tier-stops {
  position: relative;
  display: flex;
  justify-content: space-between;
  z-index: 1;
}

/* Individual tier stop — natural flow, no absolute positioning */
.tier-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
}

/* The dot on the rail */
.tier-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(60, 55, 70, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
  flex-shrink: 0;
  z-index: 2;
}

/* Reached tiers: filled gold dot */
.tier-stop.reached .tier-dot {
  background: var(--gold-600);
  border-color: var(--gold-500);
  box-shadow: 0 0 4px rgba(184, 154, 87, 0.4);
}

/* Active tier: larger pulsing dot */
.tier-stop.active .tier-dot {
  width: 14px;
  height: 14px;
  background: var(--gold-500);
  border-color: var(--gold-400);
  box-shadow: 0 0 8px rgba(184, 154, 87, 0.6), 0 0 16px rgba(184, 154, 87, 0.2);
}

/* Label block under each dot */
.tier-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 3px;
  gap: 0;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.tier-stop.reached .tier-label {
  opacity: 0.65;
}

.tier-stop.active .tier-label {
  opacity: 1;
}

/* Player count */
.tier-players {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-400);
  line-height: 1;
}

/* Price */
.tier-price {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

/* Free skills count */
.tier-skills {
  font-size: 0.5rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.2;
  white-space: nowrap;
}

/* Mobile: hide skills text, compact labels */
@media (max-width: 600px) {
  .tier-tracker {
    padding: 0.4rem 1rem 0.25rem;
  }
  .tier-track {
    left: calc(1rem + (100% - 2rem) / 12);
    right: calc(1rem + (100% - 2rem) / 12);
    top: calc(0.4rem + 4px);
  }
  .tier-skills {
    display: none;
  }
  .tier-players {
    font-size: 0.65rem;
  }
  .tier-price {
    font-size: 0.55rem;
  }
  .tier-dot {
    width: 8px;
    height: 8px;
  }
  .tier-stop.active .tier-dot {
    width: 12px;
    height: 12px;
  }
}

/* Review button */\n\n\n\n/* Stats bar responsive adjustments consolidated in MOBILE OPTIMIZATION sections below */

