/* ==========================================================================
   Fearless Draft HQ - Dark Theme & Layout Stylesheet
   ========================================================================== */

:root {
  --bg-base: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-alt: #334155;
  --bg-surface-hover: #475569;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border-color: #334155;
  
  /* Team Accents */
  --blue-primary: #3b82f6;
  --blue-glow: rgba(59, 130, 246, 0.25);
  --blue-bg: rgba(30, 58, 138, 0.4);
  --blue-border: #2563eb;
  --red-primary: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.25);
  --red-bg: rgba(127, 29, 29, 0.4);
  --red-border: #dc2626;

  /* State colors */
  --gold-accent: #f59e0b;
  --fearless-locked: #6b21a8;
  --fearless-locked-border: #a855f7;
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

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

.app-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.title-group h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.title-group .subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Series Setup Bar */
.series-setup-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  gap: 1rem;
}

.team-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.team-input-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blue-team-input label { color: var(--blue-primary); }
.red-team-input label { color: var(--red-primary); }

.team-input-group input {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.team-input-group input:focus {
  outline: none;
  border-color: var(--blue-primary);
}

.red-team-input input:focus { border-color: var(--red-primary); }

.series-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0 1rem;
}

.game-indicator {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gold-accent);
  letter-spacing: 0.1em;
}

.series-score {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}

/* Main Layout Grid (3 Columns) */
.main-layout {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 1rem;
  align-items: start;
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.875rem;
  gap: 0.5rem;
}

.panel-header h2, .panel-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  background: var(--fearless-locked);
  color: #f3e8ff;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* Column 1: Champion Pool */
.champion-pool-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 210px);
}

.search-box input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--blue-primary);
}

.champion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
  gap: 0.5rem;
  overflow-y: auto;
  padding-right: 0.25rem;
  margin-top: 0.5rem;
  flex: 1;
}

.champion-tile {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.25rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: default;
  transition: all 0.15s ease;
  user-select: none;
}

.champion-tile.available {
  cursor: pointer;
}

.champion-tile.available:hover {
  background: var(--bg-surface-hover);
  border-color: var(--blue-primary);
  transform: translateY(-1px);
}

.champion-tile.picked {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.6;
}

.champion-tile.banned {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--text-dim);
  text-decoration: line-through;
  cursor: not-allowed;
  opacity: 0.6;
}

.champion-tile.fearless {
  background: rgba(107, 33, 168, 0.25);
  border-color: var(--fearless-locked-border);
  color: #c084fc;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Column 2: Draft Board */
.draft-board-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.phase-banner {
  background: var(--bg-surface-alt);
  border-left: 4px solid var(--gold-accent);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-main);
}

.draft-board-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.team-draft-column {
  background: var(--bg-base);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.blue-column {
  border: 1px solid var(--blue-border);
  box-shadow: 0 0 10px var(--blue-glow);
}

.red-column {
  border: 1px solid var(--red-border);
  box-shadow: 0 0 10px var(--red-glow);
}

.team-label {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.blue-label { color: var(--blue-primary); }
.red-label { color: var(--red-primary); }

.draft-section h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.ban-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.slot {
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  font-size: 0.8rem;
}

.ban-slot {
  height: 38px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  color: var(--text-dim);
}

.pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pick-slot {
  height: 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0 0.75rem;
  justify-content: space-between;
}

.pick-slot .slot-num {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Slot States */
.slot.empty { opacity: 0.7; }
.slot.filled {
  background: var(--bg-surface-alt);
  border-style: solid;
  border-color: var(--text-muted);
  color: var(--text-main);
  font-weight: 600;
}

.blue-column .slot.filled {
  background: var(--blue-bg);
  border-color: var(--blue-primary);
}

.red-column .slot.filled {
  background: var(--red-bg);
  border-color: var(--red-primary);
}

.slot.locked, .slot.fearless {
  background: rgba(107, 33, 168, 0.3);
  border: 1px solid var(--fearless-locked-border);
  color: #e9d5ff;
}

/* Action Buttons */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--blue-primary);
  color: white;
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
}

.btn-primary:hover { background: #2563eb; }
.btn-secondary {
  background: var(--bg-surface-alt);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: var(--bg-surface-hover); }
.draft-actions { margin-top: 0.5rem; }

.winner-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.btn-blue-win {
  background: var(--blue-primary);
  color: white;
  flex: 1;
  padding: 0.75rem;
  font-size: 1rem;
}

.btn-blue-win:hover {
  background: #2563eb;
}

.btn-red-win {
  background: var(--red-primary);
  color: white;
  flex: 1;
  padding: 0.75rem;
  font-size: 1rem;
}

.btn-red-win:hover {
  background: #dc2626;
}

.fearless-chip {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: rgba(107, 33, 168, 0.4);
  border: 1px solid var(--fearless-locked-border);
  color: #e9d5ff;
  border-radius: var(--radius-sm);
  font-weight: 500;
  margin: 0.15rem;
}

/* Column 3: Sidebar */
.sidebar-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fearless-locked-container, .tendency-content {
  min-height: 100px;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.tendency-panel-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tendency-controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tendency-select {
  width: 100%;
  background: var(--bg-surface-alt);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.tendency-select:focus {
  border-color: var(--blue-primary);
}

.tendency-source-note {
  font-size: 0.725rem;
  color: var(--text-dim);
  font-style: italic;
  padding: 0 0.2rem;
}

.tendency-content {
  max-height: 480px;
  overflow-y: auto;
}

.tendency-record-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.825rem;
  margin-bottom: 0.75rem;
}

.tendency-record-badge .record-stat {
  font-weight: 700;
  color: var(--text-main);
}

.tendency-record-badge .winrate-stat {
  font-weight: 600;
  color: var(--gold-accent);
}

.tendency-record-badge .games-stat {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.insight-cards-wrapper {
  margin-bottom: 0.75rem;
}

.section-subtitle {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-accent);
  margin-bottom: 0.35rem;
}

.insight-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  font-size: 0.775rem;
  line-height: 1.4;
  color: #fef3c7;
}

.insight-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 0.1rem;
}

.insight-text {
  margin: 0;
}

.tendency-section {
  margin-top: 0.75rem;
}

.tendency-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.tendency-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tendency-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: var(--bg-surface);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
}

.tendency-item .item-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tendency-item .item-name {
  font-weight: 500;
  color: var(--text-main);
}

.tendency-item .item-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tendency-item .item-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--bg-surface-alt);
  border-radius: 2px;
  overflow: hidden;
}

.tendency-item .item-bar-fill {
  height: 100%;
  background: var(--blue-primary);
  border-radius: 2px;
}

.meta-item {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.meta-stats-text {
  font-size: 0.725rem;
  color: var(--text-muted);
}

.pool-counter-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.counter-label { font-size: 0.85rem; color: var(--text-muted); }
.counter-value { font-size: 1.5rem; font-weight: 700; color: var(--gold-accent); }

.placeholder-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 1.5rem 0;
}

/* Scrollbar & Responsiveness */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-surface-alt); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--bg-surface-hover); }

@media (max-width: 1280px) {
  .main-layout { grid-template-columns: 240px 1fr 260px; }
}

@media (max-width: 1024px) {
  .main-layout { grid-template-columns: 1fr; }
  .champion-pool-panel { height: 300px; }
}
