/* ══════════════════════════════════════════════════════════
   SQUAD SIMULATOR — Full-viewport locked
   Navbar 52px + Setup 48px + sim-body fills rest
   NO page scroll · Left/Right panels scroll Y only
══════════════════════════════════════════════════════════ */

html { overflow: hidden; height: 100%; }

body.sim-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Setup Bar ─────────────────────────────────────────── */
.sim-setup {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  height: 48px;
  overflow: hidden;
}
.sim-setup label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 1.5px;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
}
.sim-setup select {
  height: 28px;
  padding: 0 20px 0 8px;
  font-size: 11px;
  flex-shrink: 0;
}
.sim-setup .btn {
  height: 28px;
  padding: 0 14px;
  font-size: 11px;
  flex-shrink: 0;
}

/* ── sim-body: fills 100vh minus navbar(52) minus setup(48) */
.sim-body {
  flex: 1;
  min-height: 0;
  height: calc(100vh - 52px - 48px);
  max-height: calc(100vh - 52px - 48px);
  display: flex;
  gap: 8px;
  overflow: hidden;
  padding: 8px;
}

.sim-idle-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ══════════════════════════════════════════════════════════
   LEFT — POOL  ~25% width, Y-scroll only
══════════════════════════════════════════════════════════ */
.pool-card {
  flex: 0 0 28%;
  min-width: 190px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px;
  overflow: hidden;
  min-height: 0;
}

.pool-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.pool-search     { flex: 1; min-width: 0; height: 26px; font-size: 11px; }
.pool-pos-filter { width: 76px; flex-shrink: 0; height: 26px; font-size: 11px; }

.pool-bar-legend {
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 7.5px;
  color: var(--text3);
  margin-bottom: 5px;
  padding-left: 2px;
  flex-shrink: 0;
}
.pool-bar-legend span { display: flex; align-items: center; gap: 3px; }
.pool-bar-legend i    { display: inline-block; width: 10px; height: 2px; border-radius: 1px; }

/* Y-scroll ONLY */
.pool-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.pool-group-label {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 5px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}

.pool-group-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.pool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 3px 4px;
  border-radius: 6px;
  cursor: grab;
  border: 1px solid transparent;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  text-align: center;
  position: relative;
}
.pool-item:hover    { background: rgba(0,201,177,0.07); border-color: rgba(0,201,177,0.25); box-shadow: 0 4px 10px rgba(0,0,0,0.25); }
.pool-item.placed   { opacity: 0.22; pointer-events: none; }
.pool-item.dragging { opacity: 0.4; }

.pool-item-name {
  font-size: 9.5px; font-weight: 500; color: var(--text);
  max-width: 62px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; line-height: 1.2; font-family: var(--font-body);
}
.pool-item-arch {
  font-family: var(--font-mono); font-size: 7.5px; color: var(--text3);
  max-width: 62px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; line-height: 1.2;
}
.pool-item-bars { display: flex; gap: 2px; align-items: center; margin-top: 2px; }
.pool-item-bar-wrap { width: 26px; height: 2px; background: var(--card2); border-radius: 1px; overflow: hidden; }
.pool-item-bar-arch { height: 100%; background: var(--accent); border-radius: 1px; }
.pool-item-bar-phil { height: 100%; background: #EF9F27; border-radius: 1px; }
.pool-item-fit { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; line-height: 1; margin-top: 1px; }

/* Pool hover tooltip */
.pool-tooltip {
  display: block;
  position: fixed;
  width: 200px;
  background: var(--card2);
  border: 1px solid rgba(0,201,177,0.25);
  border-radius: 10px;
  padding: 10px;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}
.pool-tooltip-name {
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  color: var(--text); margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pool-tooltip-row   { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.pool-tooltip-pos   { font-family: var(--font-mono); font-size: 8.5px; font-weight: 700; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; }
.pool-tooltip-arch  { font-family: var(--font-mono); font-size: 8.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-tooltip-div   { height: 1px; background: var(--border); margin: 4px 0; }

/* ══════════════════════════════════════════════════════════
   CENTER — PITCH  (flex:1, never scrolls)
══════════════════════════════════════════════════════════ */
.pitch-card {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  overflow: hidden;
}

.pitch-card-header {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500;
  color: var(--text3); letter-spacing: 1.5px;
  text-transform: uppercase; margin-bottom: 5px;
  display: flex; align-items: center; gap: 8px;
}
.pitch-card-header::before {
  content: ''; display: inline-block;
  width: 3px; height: 12px;
  background: var(--accent); border-radius: 2px; flex-shrink: 0;
}
.manual-badge {
  background: rgba(239,159,39,0.14);
  border: 1px solid rgba(239,159,39,0.28);
  color: #EF9F27; font-size: 8.5px;
  padding: 1px 7px; border-radius: 4px;
}

/* Pitch surface — fills ALL height, clips slots, NEVER scrolls */
.pitch-svg-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: linear-gradient(180deg, #0b2a1b 0%, #0e3020 50%, #0b2a1b 100%);
  border-radius: 8px;
  border: 2px solid #1a4228;
  overflow: hidden;
}

/* Pitch field border */
.pitch-svg-wrap::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 3px;
  pointer-events: none;
}
.pitch-line-mid {
  position: absolute; left: 8px; right: 8px; top: 50%;
  height: 1px; background: rgba(255,255,255,0.07); pointer-events: none;
}
.pitch-circle {
  position: absolute;
  width: 80px; height: 80px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.07);
  top: 50%; left: 50%; transform: translate(-50%,-50%);
  pointer-events: none;
}
.pitch-goal-top, .pitch-goal-bot {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: 30%; height: 8%;
  border: 1px solid rgba(255,255,255,0.07); pointer-events: none;
}
.pitch-goal-top { top: 8px;    border-top: none; }
.pitch-goal-bot { bottom: 8px; border-bottom: none; }

/* ── Pitch Slot ────────────────────────────────────────── */
.pitch-slot {
  position: absolute;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.18);
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  z-index: 2;
}
.pitch-slot:hover { border-color: var(--accent) !important; background: rgba(0,201,177,0.08) !important; }
.pitch-slot.filled { border-style: solid; border-width: 2px; }
.pitch-slot.fit-high { border-color: var(--accent);  background: rgba(0,201,177,0.22); }
.pitch-slot.fit-mid  { border-color: #f5c842;         background: rgba(245,200,66,0.16); }
.pitch-slot.fit-low  { border-color: var(--red);      background: rgba(224,82,96,0.18); }
.pitch-slot.drag-over { border-color: var(--accent) !important; background: rgba(0,201,177,0.25) !important; }

.slot-label { font-family: var(--font-mono); font-size: 8.5px; color: rgba(255,255,255,0.40); line-height: 1; letter-spacing: 0.5px; }
.slot-name  { font-size: 8px; font-weight: 600; color: var(--text); max-width: 52px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; text-align: center; font-family: var(--font-body); }
.slot-score { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; line-height: 1; }

/* Slot hover tooltip — posisi + archetype only */
.slot-tooltip {
  display: none;
  position: absolute; bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: 6px; padding: 6px 10px;
  z-index: 30; pointer-events: none;
  white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
.pitch-slot:hover .slot-tooltip { display: block; }
.slot-tooltip-pos  { font-family: var(--font-mono); font-size: 8.5px; color: var(--text3); margin-bottom: 2px; }
.slot-tooltip-arch { font-family: var(--font-mono); font-size: 10px; color: var(--accent); font-weight: 600; }

.pitch-hint {
  flex-shrink: 0; margin-top: 4px;
  font-family: var(--font-mono); font-size: 8.5px;
  color: var(--text3); text-align: center; letter-spacing: 0.5px;
}

.slot-drag-handle {
  position: absolute; top: -2px; right: -2px;
  width: 14px; height: 14px;
  background: rgba(239,159,39,0.25); border: 1px solid rgba(239,159,39,0.5);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: move; font-size: 7px; color: #EF9F27;
}

/* ══════════════════════════════════════════════════════════
   RIGHT — ANALYSIS  ~25% width, Y-scroll
══════════════════════════════════════════════════════════ */
.analysis-card {
  flex: 0 0 28%;
  min-width: 190px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.overall-score-ring {
  text-align: center; padding: 4px 0 8px; flex-shrink: 0;
  border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.ring-score { font-family: var(--font-display); font-size: 50px; font-weight: 800; line-height: 1; }
.ring-label { font-family: var(--font-mono); font-size: 9px; color: var(--text3); letter-spacing: 2px; margin-top: 2px; text-transform: uppercase; }

.score-breakdown { background: var(--card2); border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; }
.sb-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.sb-lbl { font-family: var(--font-mono); font-size: 8.5px; color: var(--text3); }
.sb-val { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; }
.sb-bar-wrap { height: 3px; background: var(--border); border-radius: 2px; margin-bottom: 6px; }
.sb-bar-arch { height: 100%; background: var(--accent); border-radius: 2px; }
.sb-bar-phil { height: 100%; background: #EF9F27; border-radius: 2px; }

.sec-lbl { font-family: var(--font-mono); font-size: 8.5px; color: var(--text3); letter-spacing: 1.5px; text-transform: uppercase; margin: 0 0 6px; }

.dna-bar-row   { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.dna-bar-label { font-family: var(--font-mono); font-size: 8.5px; color: var(--text3); width: 58px; flex-shrink: 0; }
.dna-bar-track { flex: 1; height: 3px; background: var(--card2); border-radius: 2px; }
.dna-bar-fill  { height: 100%; background: var(--accent); border-radius: 2px; }
.dna-bar-val   { font-family: var(--font-mono); font-size: 8.5px; color: var(--text3); width: 22px; text-align: right; flex-shrink: 0; }

.gap-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid rgba(30,42,56,0.4); }
.gap-pos  { font-family: var(--font-mono); font-size: 9.5px; color: var(--text2); }
.gap-val  { font-family: var(--font-mono); font-size: 10px; font-weight: 700; }
.gap-crit { color: var(--red); }

.recruit-item { background: var(--card2); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 9px; margin-bottom: 5px; }
.recruit-pos  { font-family: var(--font-mono); font-size: 8.5px; color: var(--text3); letter-spacing: 1px; margin-bottom: 2px; }
.recruit-name { font-size: 11px; color: var(--text); font-weight: 500; }
.recruit-fit  { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--accent); float: right; }

/* AI Chat */
.ai-chat-box { margin-top: 10px; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; flex-shrink: 0; }
.ai-chat-header { background: var(--card2); padding: 6px 10px; font-family: var(--font-mono); font-size: 8.5px; color: var(--accent); letter-spacing: 1px; text-transform: uppercase; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); }
.ai-chat-header::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.ai-chat-messages { min-height: 80px; max-height: 130px; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; }
.ai-msg { font-size: 10px; line-height: 1.5; padding: 5px 8px; border-radius: 6px; }
.ai-msg-bot  { background: var(--card2); color: var(--text2); align-self: flex-start; max-width: 90%; }
.ai-msg-user { background: rgba(0,201,177,0.12); color: var(--text); align-self: flex-end; max-width: 90%; text-align: right; }
.ai-chat-input-row { display: flex; border-top: 1px solid var(--border); }
.ai-chat-input { flex: 1; background: transparent; border: none; padding: 6px 8px; font-size: 10px; color: var(--text); font-family: var(--font-body); outline: none; min-width: 0; }
.ai-chat-input::placeholder { color: var(--text3); }
.ai-chat-send { background: transparent; border: none; border-left: 1px solid var(--border); color: var(--accent); font-size: 11px; padding: 0 10px; cursor: pointer; font-family: var(--font-mono); transition: background 0.1s; }
.ai-chat-send:hover { background: rgba(0,201,177,0.08); }

/* Pos badges */
.pos-badge { display: inline-block; padding: 1px 5px; border-radius: 3px; font-family: var(--font-mono); font-weight: 600; font-size: 8px; }
.pos-GK  { background: rgba(201,168,76,.18);  color: #C9A84C; }
.pos-DF, .pos-CB { background: rgba(45,130,212,.18); color: #5BA4E5; }
.pos-MF  { background: rgba(0,201,177,.13);   color: var(--accent); }
.pos-FW  { background: rgba(224,82,96,.13);   color: var(--red); }

.fit-elite { color: var(--accent); }
.fit-good  { color: #2dd4a7; }
.fit-mid   { color: #f5c842; }
.fit-weak  { color: var(--red); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-box { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; min-width: 290px; max-width: 380px; max-height: 70vh; overflow-y: auto; }

/* ── Pundit Tabs (Kelebihan / Kekhawatiran / Role Favorit) ── */
.pundit-tabs {
  display: flex;
  gap: 4px;
  margin: 6px 0 8px;
  flex-wrap: wrap;
}
.ptab-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.15s;
}
.ptab-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.ptab-content { display: none; }
.ptab-content.active { display: block; }
