@import url('https://fonts.googleapis.com/css2?family=Russo+One&family=IBM+Plex+Mono:wght@400;500&family=Nunito:wght@500;700;800&display=swap');

/* ========================================
   POGO Cleanup — Production Styles
   Clean utility theme · Mobile-first · WCAG AA
   ======================================== */

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --surface: #f8fafc;
  --text: #1e293b;
  --highlight: #f59e0b;
  --info: #3b82f6;
  --success: #22c55e;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --warning: #e67e22;
  --warning-light: #fef3e2;
  --warning-border: #f0a830;

  --ink: #14213d;
  --muted: #5e6b8c;
  --card: #ffffff;
  --bg: var(--surface);
  --line: #e0e5ec;

  --accent: var(--primary);
  --accent-strong: var(--primary-dark);

  --shadow-drop: 0 12px 30px rgba(0,0,0,0.15);
  --shadow-inner: inset 0 3px 6px rgba(0,0,0,0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;

  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
}

body {
  font-family: "Nunito", "Segoe UI", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  padding-bottom: 4rem;
}

/* ── Focus styles for accessibility ── */
:focus-visible {
  outline: 3px solid var(--info);
  outline-offset: 2px;
}

/* ── Header ── */
.site-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  padding: 2.5rem 1rem 2.5rem;
  position: relative;
  text-align: center;
  box-shadow: 0 6px 12px rgba(13, 148, 136, 0.3);
  border-bottom: 2px solid var(--primary-dark);
}

.header-text h1 {
  margin: 0;
  font-family: "Russo One", sans-serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.header-text p {
  margin: 0.5rem 0 0;
  font-weight: 700;
  color: #ccfbf1;
  letter-spacing: 0.03em;
}

/* ── Layout ── */
.layout {
  max-width: 860px;
  margin: 3rem auto 0;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Popdown (details/summary) panels ── */
.top-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.popdown {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border: 2px solid var(--line);
}

.popdown summary {
  padding: 1rem 1.25rem;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  background: linear-gradient(to bottom, #fff, #f4f6f9);
  border-radius: var(--radius-md);
  transition: background-color 0.2s;
}

.popdown summary::-webkit-details-marker { display: none; }

.popdown summary:hover {
  background: linear-gradient(to bottom, #f0f4ff, #e3ebfb);
}

.popdown[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: 2px solid var(--line);
  background: #f0f4ff;
}

.popdown summary .icon { margin-right: auto; }
.popdown summary .chevron {
  transition: transform 0.3s;
  font-size: 0.8rem;
  color: var(--muted);
}
.popdown[open] summary .chevron { transform: rotate(180deg); }

.popdown-content {
  padding: 1.2rem;
  background: #fff;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ── Config panel ── */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

h2, h3 { margin-top: 0; }
h2 { font-size: 1.3rem; margin-bottom: 1rem; }
h3 { font-size: 1.05rem; margin-bottom: 0.5rem; color: var(--info); }

.control-group {
  border-top: 2px dashed var(--line);
  padding-top: 1rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.control-group:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* Preset selector at top of config */
.preset-group {
  background: linear-gradient(to bottom, #f0f4ff, #e8edfa);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.5rem;
  border: 2px solid var(--info);
}
.preset-group h3 { color: var(--info); margin: 0 0 0.5rem 0; }
.preset-description {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
  font-style: italic;
}

/* Per-league controls */
.league-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.league-section {
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}
.league-section h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: var(--ink);
}
.league-section label {
  font-size: 0.9rem;
}

label {
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

input[type="text"], select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  font: inherit;
  background: #fafbfc;
  color: var(--ink);
  transition: border-color 0.2s;
}
input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: var(--focus-ring);
}

input[type="checkbox"] {
  width: 1.1em;
  height: 1.1em;
  accent-color: var(--info);
}

/* Instructions content */
.instructions-content { color: var(--muted); }
.instructions-content h3 { color: var(--primary); margin-top: 1.2rem; }
.instructions-content h3:first-child { margin-top: 0; }
.instructions-steps { padding-left: 1.4rem; }
.instructions-steps li { margin-bottom: 0.5rem; line-height: 1.6; }
.instructions-steps code { background: #e8edf4; padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.9em; }
.instructions-list { padding-left: 1.4rem; }
.instructions-list li { margin-bottom: 0.4rem; line-height: 1.5; }

/* Config section helper text */
.config-helper {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 0.4rem;
  line-height: 1.4;
}

/* "Why this step?" collapsible on step cards */
.step-why {
  margin: 0 0 0.75rem;
  border-radius: var(--radius-sm);
  padding: 0;
}
.step-why summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--info);
  list-style: none;
  user-select: none;
  padding: 0.25rem 0;
}
.step-why summary::-webkit-details-marker { display: none; }
.step-why summary:hover { text-decoration: underline; }
.step-why p {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.55;
  margin: 0.3rem 0 0;
  padding: 0.5rem 0.75rem;
  background: #f0f4ff;
  border-left: 3px solid var(--info);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Main Filters Panel ── */
.main-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.main-panel-head h2 { margin: 0; font-size: 1.6rem; color: var(--text); }

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

/* ── Buttons ── */
button {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn {
  background: var(--highlight);
  color: var(--text);
  border: 2px solid #e5a400;
  box-shadow: 0 4px 0 #d19500;
}
.action-btn:hover { background: #ffe066; transform: translateY(-2px); box-shadow: 0 6px 0 #d19500; }
.action-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #d19500; }

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 2px solid var(--line);
}
.ghost-btn:hover { background: #f0f4ff; color: var(--info); border-color: var(--info); }

.copy-action {
  background: var(--info);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 99px;
  box-shadow: 0 4px 10px rgba(77, 149, 255, 0.4);
}
.copy-action:hover { background: #3b7ce0; transform: scale(1.05); }
.copy-action:active { transform: scale(0.95); }

/* ── Step Cards ── */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.step-card {
  background: white;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  box-shadow: 0 6px 16px rgba(0,0,0,0.04);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: background-color 0.4s;
}

/* Sub-step indentation for PvP leagues */
.step-card.sub-step {
  margin-left: 1.5rem;
  border-left: 4px solid var(--info);
}
.step-card.sub-step .step-number {
  width: 34px;
  height: 34px;
  font-size: 0.85rem;
  background: var(--info);
}

/* Review step — amber/warning styling */
.step-card.review-step {
  border-color: var(--warning-border);
  background: var(--warning-light);
}
.step-card.review-step .step-number {
  background: var(--warning);
}
.step-card.review-step .step-content {
  background: #fdf0db;
  border-color: var(--warning-border);
}

/* Transfer step styling */
.step-card.transfer-step {
  border-color: var(--danger);
}
.step-card.transfer-step .step-number {
  background: var(--danger);
}

/* Clear tag step styling */
.step-card.clear-step {
  opacity: 0.85;
}
.step-card.clear-step .step-number {
  background: var(--muted);
}

/* Flash effect on copy */
@keyframes flashRow {
  0%   { background-color: #dcfce7; }
  100% { background-color: white; }
}
.step-card.flash { animation: flashRow 0.5s ease-out; }
.step-card.review-step.flash { animation: flashRowAmber 0.5s ease-out; }
@keyframes flashRowAmber {
  0%   { background-color: #dcfce7; }
  100% { background-color: var(--warning-light); }
}

.step-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.step-number {
  background: var(--text);
  color: white;
  font-family: inherit;
  font-weight: 800;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.step-titles h3 { margin: 0; font-size: 1.15rem; color: var(--text); }
.step-notes { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.bullet { color: #ccc; margin: 0 0.3rem; }

/* Part label for split filters */
.part-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--warning);
  margin-bottom: 0.25rem;
}

.step-content {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  background: #f8fafd;
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
}

.tag-badge {
  background: #dee2e6;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  display: inline-block;
}

.filter-reveal {
  flex: 1 1 100%;
  width: 100%;
}

.filter-details summary {
  color: var(--info);
  cursor: pointer;
  font-weight: 700;
  user-select: none;
  display: inline-block;
}
.filter-details summary:hover { text-decoration: underline; }

.filter-code {
  margin-top: 0.8rem;
  background: #111827;
  color: #a7f3d0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  white-space: nowrap;
  word-break: break-all;
}

/* ── Legacy Move Warning Banner ── */
.legacy-warning {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #856404;
}
.legacy-warning summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.legacy-warning summary::-webkit-details-marker { display: none; }
.legacy-warning p { margin: 0.5rem 0 0; }

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 40px);
  background: var(--text);
  color: white;
  border-radius: 99px;
  padding: 0.7rem 1.4rem;
  font-weight: 700;
  opacity: 0;
  transition: all 0.3s;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 100;
  text-align: center;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Footer ── */
.site-footer {
  max-width: 860px;
  margin: 3rem auto 0;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 2px solid var(--line);
}
.site-footer .data-version {
  font-family: "IBM Plex Mono", monospace;
  margin-bottom: 0.5rem;
}
.site-footer .disclaimer {
  max-width: 600px;
  margin: 0.5rem auto 0;
  line-height: 1.4;
}

.footer-legal {
  max-width: 600px;
  margin: 0.5rem auto 0;
  font-size: 0.7rem;
  opacity: 0.7;
}
.footer-legal summary {
  cursor: pointer;
  text-decoration: underline;
}
.footer-legal .legal-text {
  margin-top: 0.3rem;
  line-height: 1.4;
}

/* ── Responsive: Tablet+ ── */
@media (min-width: 640px) {
  .step-content {
    flex-wrap: nowrap;
    align-items: center;
  }
  .filter-reveal { flex: 1; }
  .copy-action { flex-shrink: 0; }

  .league-group {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .step-card.sub-step {
    margin-left: 2.5rem;
  }
}

/* ========================================
   Dark Mode
   ======================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a2e;
    --card: #16213e;
    --ink: #e0e0e0;
    --muted: #a0a8c0;
    --line: #2a3050;
    --warning-light: #2d2518;
  }

  body { background-color: var(--bg); color: var(--ink); }

  .popdown { background: var(--card); border-color: var(--line); }
  .popdown summary { background: linear-gradient(to bottom, #1e2a45, #162040); color: var(--ink); }
  .popdown summary:hover { background: linear-gradient(to bottom, #243050, #1e2a48); }
  .popdown[open] summary { background: #1e2a48; border-color: var(--line); }
  .popdown-content { background: var(--card); }

  .step-card { background: var(--card); border-color: var(--line); }
  .step-content { background: #0f1626; border-color: var(--line); }
  .step-titles h3 { color: var(--ink); }
  .step-why p { background: #1e2a48; border-left-color: var(--info); }

  .instructions-steps code { background: #2a3050; color: #c0c8e0; }

  .tag-badge { background: #2a3050; color: #c0c8e0; }

  .filter-code { background: #0a0e1a; }

  .preset-group { background: linear-gradient(to bottom, #1e2a48, #162040); border-color: var(--info); }
  .league-section { background: #0f1626; border-color: var(--line); }

  input[type="text"], select {
    background: #0f1626;
    color: var(--ink);
    border-color: var(--line);
  }

  .ghost-btn { color: var(--muted); border-color: var(--line); }
  .ghost-btn:hover { background: #1e2a48; }

  .legacy-warning { background: #2d2518; border-color: #6d5a18; color: #e0c060; }

  .site-footer { border-color: var(--line); }

  .step-card.review-step { background: var(--warning-light); border-color: #6d5a18; }
  .step-card.review-step .step-content { background: #241e10; border-color: #6d5a18; }

  @keyframes flashRow {
    0%   { background-color: #1a3d2a; }
    100% { background-color: var(--card); }
  }
  @keyframes flashRowAmber {
    0%   { background-color: #1a3d2a; }
    100% { background-color: var(--warning-light); }
  }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
  .top-controls,
  .button-row,
  .copy-action,
  .copy-btn,
  .toast,
  .popdown { display: none !important; }

  body { padding: 0; background: white; color: black; }

  .site-header {
    background: white;
    color: black;
    border-bottom: 2px solid black;
    box-shadow: none;
    padding: 1rem;
  }
  .header-text h1 { text-shadow: none; color: black; }
  .header-text p { color: #333; }

  .layout { margin-top: 1rem; }

  .step-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }

  .filter-details[open] .filter-code,
  .filter-code {
    white-space: pre-wrap;
    word-break: break-all;
  }

  /* Show all filters when printing */
  .filter-details { display: block; }
  .filter-details > summary { display: none; }
  .filter-details .filter-code { display: block; }

  .site-footer { border-top: 1px solid #ccc; }
}
