/*
 * Draft War Room theme - a tactical command-console treatment for the one page
 * it's scoped to (body.war-room-body / .war-room), everything else in the app
 * stays default Bootstrap. Loaded automatically by stylesheet_link_tag :app
 * (Propshaft includes every file under app/assets/stylesheets), so no <link>
 * wiring beyond the Google Fonts import in war_room.html.erb's content_for(:head).
 *
 * Bootstrap's stylesheet gets double-included on every page in this app
 * (stylesheet_link_tag :app globs vendor/bootstrap.min.css a second time,
 * loading after application.css) and Bootstrap's own utility classes carry
 * !important - so any override of a Bootstrap class name needs matching
 * !important plus a two-class-deep selector to reliably win regardless of
 * load order. See table.draft-order-table elsewhere in this file for the
 * same pattern already proven out.
 */

body.war-room-body {
  background: #0B0F0D;
  background-image:
    repeating-linear-gradient(0deg, rgba(62, 250, 140, 0.025) 0px, rgba(62, 250, 140, 0.025) 1px, transparent 1px, transparent 3px),
    linear-gradient(rgba(62, 250, 140, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(62, 250, 140, 0.05) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
  color: #D8E8DE;
}

.war-room {
  --wr-hull: #0B0F0D;
  --wr-panel: #141B17;
  --wr-grid: #263029;
  --wr-phosphor: #3EFA8C;
  --wr-amber: #FFB020;
  --wr-alert: #FF3B30;
  --wr-text: #D8E8DE;
  --wr-text-dim: #7C9284;
  --wr-blue: #5BC0FF;
  --wr-teal: #7ED9D3;
  --wr-steel: #9AA5A0;

  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--wr-text);
  padding-bottom: 3rem;
}

/* Turbo Drive's built-in navigation indicator, themed to match the console
   aesthetic instead of its default blue - relevant here because compare.html.erb
   opts out of Turbo's page cache (see its content_for(:head)), so this bar is
   the only visible loading feedback while the comparison page is fetched fresh. */
body.war-room-body .turbo-progress-bar {
  background-color: var(--wr-phosphor, #3EFA8C);
  box-shadow: 0 0 6px 1px var(--wr-phosphor, #3EFA8C);
}

.war-room a {
  color: var(--wr-phosphor);
}

.war-room .wr-mono {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------- HUD status bar ---------- */

.war-room .wr-hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid var(--wr-grid);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.war-room .wr-hud-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.war-room .wr-hud-title h1 {
  font-family: "Big Shoulders Stencil", sans-serif;
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0;
  color: var(--wr-text);
}

.war-room .wr-hud-mark {
  color: var(--wr-phosphor);
}

.war-room .wr-hud-status {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wr-text-dim);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.war-room .wr-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wr-phosphor);
  box-shadow: 0 0 6px 1px var(--wr-phosphor);
  animation: wr-blink 1.6s ease-in-out infinite;
}

.war-room .wr-hud-link {
  color: var(--wr-text-dim);
  text-decoration: none;
  border: 1px solid var(--wr-grid);
  padding: 0.15rem 0.6rem;
  border-radius: 2px;
}

.war-room .wr-hud-link:hover {
  color: var(--wr-phosphor);
  border-color: var(--wr-phosphor);
}

/* ---------- Mission clock (signature element) ---------- */

.war-room .wr-mission-clock {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  padding: 2rem 1rem;
  border: 1px solid var(--wr-grid);
  border-radius: 4px;
  background: var(--wr-panel);
  overflow: hidden;
}

.war-room .wr-clock-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220px;
  height: 220px;
  margin: -110px 0 0 -110px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0%, var(--wr-phosphor) 8%, transparent 16%);
  opacity: 0.35;
  animation: wr-sweep 4s linear infinite;
}

.war-room .wr-mission-clock.wr-clock--alert .wr-clock-ring {
  background: conic-gradient(from 0deg, transparent 0%, var(--wr-alert) 12%, transparent 22%);
  animation-duration: 1.4s;
}

.war-room .wr-clock-face {
  position: relative;
  text-align: center;
}

.war-room .wr-clock-digit {
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 4.5rem;
  line-height: 1;
  color: var(--wr-amber);
  text-shadow: 0 0 18px currentColor;
}

.war-room .wr-clock-label {
  margin-top: 0.5rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--wr-text-dim);
}

.war-room .wr-mission-clock.wr-clock--alert .wr-clock-digit,
.war-room .wr-mission-clock.wr-clock--alert .wr-clock-label {
  color: var(--wr-alert);
  animation: wr-pulse 1s ease-in-out infinite;
}

.war-room .wr-mission-clock.wr-clock--complete .wr-clock-digit,
.war-room .wr-mission-clock.wr-clock--idle .wr-clock-digit {
  color: var(--wr-text-dim);
  text-shadow: none;
}

.war-room .wr-manifest {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 1.5rem;
}

.war-room .wr-manifest li {
  padding: 0.15rem 0;
  white-space: nowrap;
}

.war-room .wr-manifest-num {
  color: var(--wr-text-dim);
  margin-right: 0.5rem;
}

.war-room .wr-manifest-team {
  color: var(--wr-phosphor);
  cursor: pointer;
}

.war-room .wr-manifest-team:hover {
  text-decoration: underline;
}

/* ---------- Panels ---------- */

.war-room .wr-panel {
  position: relative;
  background: var(--wr-panel);
  border: 1px solid var(--wr-grid);
  border-radius: 2px;
  height: 100%;
}

.war-room .wr-panel::before,
.war-room .wr-panel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--wr-phosphor);
  border-style: solid;
  opacity: 0.7;
}

.war-room .wr-panel::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.war-room .wr-panel::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

.war-room .wr-panel-header {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--wr-phosphor);
  border-bottom: 1px solid var(--wr-grid);
  padding: 0.5rem 0.85rem;
}

.war-room .wr-section-label {
  font-family: "Big Shoulders Stencil", sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--wr-text);
  margin: 1.75rem 0 0.6rem;
}

.war-room .wr-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.war-room .wr-section-header .wr-section-label {
  margin-bottom: 0;
}

.war-room .wr-sort-toggle {
  display: flex;
  gap: 0.35rem;
}

.war-room .wr-sort-toggle-btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--wr-text-dim);
  background: transparent;
  border: 1px solid var(--wr-grid);
  border-radius: 2px;
  padding: 0.15rem 0.6rem;
  cursor: pointer;
}

.war-room .wr-sort-toggle-btn:hover {
  color: var(--wr-text);
  border-color: var(--wr-text-dim);
}

.war-room .wr-sort-toggle-btn.active {
  color: var(--wr-phosphor);
  border-color: var(--wr-phosphor);
}

/* ---------- Rows (my picks / top adp / available by position) ---------- */

.war-room .wr-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0.6rem;
}

.war-room .wr-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0.25rem;
  border-bottom: 1px solid var(--wr-grid);
  font-size: 0.85rem;
}

.war-room .wr-row:last-child {
  border-bottom: none;
}

.war-room .wr-row-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--wr-text-dim);
  flex-shrink: 0;
}

.war-room .wr-row-name {
  flex-grow: 1;
  cursor: pointer;
  color: var(--wr-text);
}

.war-room .wr-row-name:hover {
  color: var(--wr-phosphor);
}

.war-room .wr-row-detail {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--wr-text-dim);
  text-align: right;
  white-space: nowrap;
}

/* IFF position tags - small colored squares instead of full pastel fills */
.war-room .wr-iff {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 1px;
  flex-shrink: 0;
}

.war-room .wr-iff--qb { background: #FF6B6B; }
.war-room .wr-iff--rb { background: var(--wr-phosphor); }
.war-room .wr-iff--wr { background: var(--wr-blue); }
.war-room .wr-iff--te { background: var(--wr-amber); }
.war-room .wr-iff--k { background: var(--wr-teal); }
.war-room .wr-iff--def { background: var(--wr-steel); }

/* Survival badge - percent chance a Top 10 Available player is still on the
   board at the user's next pick. */
.war-room .wr-survival {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  text-align: center;
}

.war-room .wr-survival--high { color: var(--wr-phosphor); background: rgba(62, 250, 140, 0.12); }
.war-room .wr-survival--mid { color: var(--wr-amber); background: rgba(255, 176, 32, 0.12); }
.war-room .wr-survival--low { color: var(--wr-alert); background: rgba(255, 59, 48, 0.12); }

/* 150px let auto-fit pack in 5 columns on an iPad-width viewport, too
 * narrow for a .wr-row's name + ADP/tier/pts + survival badge on one
 * nowrap line. 230px keeps auto-fit's natural responsiveness but caps it
 * to ~3 columns at iPad portrait width / ~4 at landscape, giving each
 * panel enough room for its content. */
.war-room .wr-position-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.75rem;
}

.war-room .wr-panel-header--qb { color: #FF6B6B; }
.war-room .wr-panel-header--rb { color: var(--wr-phosphor); }
.war-room .wr-panel-header--wr { color: var(--wr-blue); }
.war-room .wr-panel-header--te { color: var(--wr-amber); }
.war-room .wr-panel-header--k { color: var(--wr-teal); }
.war-room .wr-panel-header--def { color: var(--wr-steel); }

/* ---------- Data feeds footer ---------- */

.war-room .wr-feeds {
  border-top: 1px solid var(--wr-grid);
  margin-top: 2rem;
  padding-top: 0.85rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wr-text-dim);
}

.war-room .wr-feeds a {
  color: var(--wr-text-dim);
}

.war-room .wr-feeds a:hover {
  color: var(--wr-phosphor);
}

/* ---------- Modals (shared partials, dark-themed only while on this page) ---------- */

body.war-room-body .modal-content {
  background: var(--wr-panel, #141B17);
  border: 1px solid var(--wr-grid, #263029);
  color: var(--wr-text, #D8E8DE);
}

body.war-room-body .modal-header {
  border-bottom-color: var(--wr-grid, #263029);
}

body.war-room-body .btn-close {
  filter: invert(1) grayscale(100%) brightness(1.6);
}

body.war-room-body .modal .table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(62, 250, 140, 0.06);
  --bs-table-color: var(--wr-text, #D8E8DE);
  --bs-table-striped-color: var(--wr-text, #D8E8DE);
  --bs-border-color: var(--wr-grid, #263029);
}

/* team_history_controller.js colors pick rows with Bootstrap's bg-*-subtle
 * utilities (pale backgrounds meant for light theme, paired with dark text
 * by default). The dark-theme override above forces every table cell to
 * this theme's light chalk text color, which reads fine on the table's own
 * transparent/dark background but is nearly unreadable against these pale
 * position backgrounds - so cells with one of these classes need their own
 * dark text back, same as they'd render on the light Draft Board page.
 */
body.war-room-body .modal .table td.bg-danger-subtle,
body.war-room-body .modal .table td.bg-success-subtle,
body.war-room-body .modal .table td.bg-primary-subtle,
body.war-room-body .modal .table td.bg-warning-subtle,
body.war-room-body .modal .table td.bg-info-subtle,
body.war-room-body .modal .table td.bg-secondary-subtle {
  color: #212529 !important;
}

body.war-room-body .modal .text-muted {
  color: var(--wr-text-dim, #7C9284) !important;
}

/* ---------- Player comparison table ---------- */

.war-room .wr-compare-scroll {
  overflow-x: auto;
}

.war-room .wr-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}

.war-room .wr-compare-table th,
.war-room .wr-compare-table td {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--wr-grid);
  border-right: 1px solid var(--wr-grid);
  text-align: left;
}

.war-room .wr-compare-table th:last-child,
.war-room .wr-compare-table td:last-child {
  border-right: none;
}

.war-room .wr-compare-table thead th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wr-phosphor);
  border-bottom: 1px solid var(--wr-grid);
  vertical-align: bottom;
}

.war-room .wr-compare-table tbody th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wr-text-dim);
  white-space: nowrap;
}

.war-room .wr-compare-table tbody tr:hover td,
.war-room .wr-compare-table tbody tr:hover th {
  background: rgba(62, 250, 140, 0.05);
}

.war-room .wr-compare-row-label {
  position: sticky;
  left: 0;
  background: var(--wr-panel);
  z-index: 1;
}

.war-room .wr-compare-table td.wr-compare-best {
  background: rgba(62, 250, 140, 0.14);
  color: var(--wr-phosphor);
  font-weight: 700;
}

.war-room .wr-compare-table tr.wr-compare-section th {
  position: static;
  background: rgba(0, 0, 0, 0.25);
  color: var(--wr-steel);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
}

body.war-room-body .modal .text-dark {
  color: var(--wr-text-dim, #7C9284) !important;
}

body.war-room-body .modal h6 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wr-phosphor, #3EFA8C);
}

/* ---------- Footer nav (shared partial, dark-themed only on this page) ---------- */

body.war-room-body footer.border-top {
  background: #0B0F0D;
  border-top-color: var(--wr-grid, #263029) !important;
}

body.war-room-body footer.border-top a {
  color: var(--wr-text-dim, #7C9284);
}

body.war-room-body footer.border-top a:hover {
  color: var(--wr-phosphor, #3EFA8C);
}

/* ---------- Motion ---------- */

@keyframes wr-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@keyframes wr-sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes wr-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .war-room .wr-live-dot,
  .war-room .wr-clock-ring,
  .war-room .wr-mission-clock.wr-clock--alert .wr-clock-digit,
  .war-room .wr-mission-clock.wr-clock--alert .wr-clock-label {
    animation: none;
  }
}
