/* ═══════════════════════════════════════════════════════════════
   Pokémon GO Raid Analyzer — Unified Dark Theme Design System
   Based on: game-data-qa.html & dps-calculator.test.html
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* ── Core Colors ── */
  --bg:       #0a0d14;
  --surface:  #141720;
  --surface2: #1e2235;
  --surface3: #252a40;
  --border:   #2d3354;
  
  /* ── Accent Colors ── */
  --accent:   #6c75ff;
  --accent2:  #a78bfa;
  
  /* ── Status Colors ── */
  --green:    #22c55e;
  --red:      #ef4444;
  --yellow:   #f59e0b;
  --blue:     #38bdf8;
  --pass:     #22c55e;
  --fail:     #ef4444;
  --warn:     #f59e0b;
  
  /* ── Text Colors ── */
  --text:     #e2e8f0;
  --muted:    #7b84a3;
  
  /* ── Fonts ── */
  --mono:     'JetBrains Mono', monospace;
  --sans:     'Inter', sans-serif;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 1.5rem 1rem;
  line-height: 1.6;
}

.page-wrapper,
.wrap {
  max-width: 1100px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER COMPONENTS
   ═══════════════════════════════════════════════════════════════ */

.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.header-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.src-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid var(--green);
  border-radius: 5px;
  padding: 0.15rem 0.55rem;
  color: var(--green);
  margin-top: 0.4rem;
}

/* ═══════════════════════════════════════════════════════════════
   CONTROL PANEL & INPUTS
   ═══════════════════════════════════════════════════════════════ */

.controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: end;
}

@media (max-width: 700px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }
}

.ctrl-group,
.input-group {
  display: flex;
  flex-direction: column;
}

.ctrl-group label,
.input-group label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ctrl-group input,
.ctrl-group select,
.input-group input,
.input-group select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.2s;
}

.ctrl-group input:focus,
.ctrl-group select:focus,
.input-group input:focus,
.input-group select:focus {
  border-color: var(--accent);
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.run-btn,
.calc-btn,
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.5rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap;
}

.run-btn:hover,
.calc-btn:hover,
.btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.run-btn:active,
.calc-btn:active,
.btn-primary:active {
  transform: translateY(0);
}

.run-btn:disabled,
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.mode-btn {
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  color: var(--text);
}

.mode-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   SECTIONS & CARDS
   ═══════════════════════════════════════════════════════════════ */

.d-sec,
.calc-section,
.formula-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.d-ttl,
.section-title,
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.calc-section h2,
.formula-box h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--accent2);
}

/* ═══════════════════════════════════════════════════════════════
   RESULT CHIPS & STATS
   ═══════════════════════════════════════════════════════════════ */

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.result-chip {
  background: var(--surface2);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  text-align: center;
}

.result-chip .r-label {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
}

.result-chip .r-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent2);
  margin-top: 0.2rem;
}

.result-chip.highlight .r-value {
  color: var(--pass);
  font-size: 1.75rem;
}

.stat-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stat-box {
  flex: 1;
  min-width: 70px;
  background: var(--surface3);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  text-align: center;
}

.stat-box .sl {
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
}

.stat-box .sv {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent2);
  margin-top: 0.15rem;
}

/* ═══════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════ */

.results-wrap {
  overflow-x: auto;
}

table,
.mv-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead th,
.mv-tbl th {
  background: var(--surface3);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  white-space: nowrap;
}

thead th.num,
thead th.r,
.mv-tbl th.r {
  text-align: right;
}

tbody tr,
.mv-tbl tbody tr {
  border-bottom: 1px solid rgba(45, 51, 84, 0.5);
  transition: background 0.15s;
}

tbody tr:hover,
.mv-tbl tbody tr:hover {
  background: var(--surface);
}

tbody tr:last-child td,
.mv-tbl tr:last-child td {
  border-bottom: none;
}

tbody td,
.mv-tbl td {
  padding: 0.55rem 1rem;
  vertical-align: middle;
}

tbody td.num,
tbody td.r,
.mv-tbl td.r {
  text-align: right;
  font-family: var(--mono);
}

.mv-tbl tr.hl {
  background: rgba(108, 117, 255, 0.1);
}

/* ═══════════════════════════════════════════════════════════════
   BADGES & LABELS
   ═══════════════════════════════════════════════════════════════ */

.elite-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.05rem 0.35rem;
  background: rgba(245, 158, 11, 0.15);
  color: var(--yellow);
  border-radius: 3px;
  margin-left: 0.3rem;
}

.type-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  margin-right: 0.2rem;
}

/* Type colors */
.t-fire { background: rgba(255, 100, 50, 0.15); color: #ff7043; }
.t-water { background: rgba(33, 150, 243, 0.15); color: #42a5f5; }
.t-grass { background: rgba(76, 175, 80, 0.15); color: #66bb6a; }
.t-electric { background: rgba(255, 235, 59, 0.15); color: #ffee58; }
.t-psychic { background: rgba(233, 30, 99, 0.15); color: #ec407a; }
.t-ice { background: rgba(38, 198, 218, 0.15); color: #26c6da; }
.t-dragon { background: rgba(93, 64, 233, 0.15); color: #7c4dff; }
.t-dark { background: rgba(84, 60, 45, 0.3); color: #a67c52; }
.t-fairy { background: rgba(255, 130, 180, 0.15); color: #f48fb1; }
.t-fighting { background: rgba(195, 80, 62, 0.15); color: #ef6c55; }
.t-poison { background: rgba(156, 39, 176, 0.15); color: #ce93d8; }
.t-ground { background: rgba(180, 130, 70, 0.15); color: #d4a567; }
.t-flying { background: rgba(130, 170, 230, 0.15); color: #90b8e8; }
.t-bug { background: rgba(130, 180, 50, 0.15); color: #a5c93e; }
.t-rock { background: rgba(160, 140, 100, 0.15); color: #bcaa75; }
.t-ghost { background: rgba(100, 60, 160, 0.15); color: #9575cd; }
.t-steel { background: rgba(170, 180, 200, 0.15); color: #90a4ae; }
.t-normal { background: rgba(160, 160, 160, 0.15); color: #bdbdbd; }

.badge-gmax {
  display: inline-block;
  background: rgba(239, 68, 68, 0.2);
  color: var(--red);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════
   STATUS & FEEDBACK
   ═══════════════════════════════════════════════════════════════ */

.status-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.summary-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.summary-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.summary-badge .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-pass { background: var(--pass); box-shadow: 0 0 6px var(--pass); }
.dot-fail { background: var(--fail); box-shadow: 0 0 6px var(--fail); }
.dot-warn { background: var(--warn); box-shadow: 0 0 6px var(--warn); }

.notice {
  border: 1px solid var(--yellow);
  background: rgba(245, 158, 11, 0.1);
  color: var(--yellow);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════════════
   QA CARDS
   ═══════════════════════════════════════════════════════════════ */

.qa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.qa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.qa-card.pass { border-left: 3px solid var(--green); }
.qa-card.fail { border-left: 3px solid var(--red); }
.qa-card.warn { border-left: 3px solid var(--yellow); }

.q-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.q-val {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 600;
}

.q-val.ok { color: var(--green); }
.q-val.bad { color: var(--red); }
.q-val.num { color: var(--blue); }
.q-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* ═══════════════════════════════════════════════════════════════
   RANKING & POKEMON DISPLAY
   ═══════════════════════════════════════════════════════════════ */

.rank {
  font-weight: 700;
  color: var(--muted);
  font-family: var(--mono);
}

.rank.gold { color: #f6c026; }
.rank.silver { color: #b5bfcc; }
.rank.bronze { color: #cd7f32; }

.poke-name {
  font-weight: 600;
}

.poke-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.poke-link {
  cursor: pointer;
  color: var(--accent2);
}

.poke-link:hover {
  text-decoration: underline;
}

.move-cell {
  font-size: 0.8rem;
}

.move-name {
  font-weight: 500;
}

.move-sub {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--mono);
}

.dps-main {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent2);
}

.dps-sub {
  font-size: 0.7rem;
  color: var(--green);
  font-family: var(--mono);
}

/* ═══════════════════════════════════════════════════════════════
   PROGRESS BARS
   ═══════════════════════════════════════════════════════════════ */

.bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 100px;
}

.bar-bg {
  flex: 1;
  height: 5px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════════════════════════ */

.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */

.note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mono {
  font-family: var(--mono);
}

/* ═══════════════════════════════════════════════════════════════
   RAID RANKING SPECIFIC STYLES
   ═══════════════════════════════════════════════════════════════ */

.chip-row {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.chip {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}

.neutral-section {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.move-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--surface2);
  border-radius: 8px;
}

.move-meta-item {
  flex: 1;
  min-width: 100px;
}

.move-meta-item strong {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.move-meta-item div {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent2);
}

.results-header {
  margin-bottom: 1.5rem;
}

.results-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.results-header small {
  font-size: 0.85rem;
  color: var(--muted);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.section-heading strong {
  font-size: 0.95rem;
  font-weight: 600;
}

.section-heading span {
  font-size: 0.75rem;
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.card-stats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.card-stats span {
  font-family: var(--mono);
  color: var(--muted);
}

.card-chip {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--surface3);
  color: var(--text);
}

.partner-info {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}

.result-sections > div {
  margin-bottom: 2rem;
}

/* ═══════════════════════════════════════════════════════════════
   SORTABLE TABLE HEADERS
   ═══════════════════════════════════════════════════════════════ */

.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background 0.2s;
}

.sortable:hover {
  background: var(--surface2);
}

.sort-icon {
  display: inline-block;
  margin-left: 0.3rem;
  opacity: 0.3;
  font-size: 0.7rem;
}

.sort-icon::before {
  content: '⇅';
}

.sortable.asc .sort-icon::before {
  content: '↑';
  opacity: 1;
  color: var(--accent);
}

.sortable.desc .sort-icon::before {
  content: '↓';
  opacity: 1;
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   COLOR CODING FOR SURVIVAL HITS
   ═══════════════════════════════════════════════════════════════ */

.hits-safe {
  color: var(--green) !important;
}

.hits-warning {
  color: var(--yellow) !important;
}

.hits-danger {
  color: var(--red) !important;
}
