/* ─── FPL Lineups Plugin ─── */

:root {
  --fplu-pitch: #2d8c3c;
  --fplu-pitch-line: rgba(255,255,255,.18);
  --fplu-pitch-light: #38a349;
  --fplu-card-bg: rgba(10,22,40,.92);
  --fplu-card-border: rgba(255,255,255,.08);
  --fplu-text: #fff;
  --fplu-muted: rgba(255,255,255,.55);
  --fplu-accent: #00e676;
  --fplu-yellow: #fdd835;
  --fplu-red: #ef5350;
  --fplu-bonus: #ab47bc;
  --fplu-goal: #00e676;
  --fplu-radius: 14px;
}

/* ─── Container ─── */

.fplu {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--fplu-text);
}

.fplu-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--fplu-muted);
  font-size: 15px;
}

.fplu-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--fplu-red);
  font-size: 14px;
}

/* ─── Header ─── */

.fplu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.fplu-gw-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}

.fplu-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239,83,80,.15);
  color: var(--fplu-red);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.fplu-live-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--fplu-red);
  border-radius: 50%;
  animation: fplu-pulse 1.4s infinite;
}

@keyframes fplu-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

/* ─── Fixture Grid ─── */

.fplu-fixtures {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* ─── Fixture Card ─── */

.fplu-fixture {
  background: var(--fplu-card-bg);
  border: 1px solid var(--fplu-card-border);
  border-radius: var(--fplu-radius);
  overflow: hidden;
}

.fplu-fixture.is-live {
  border-color: rgba(239,83,80,.3);
}

/* Score bar */
.fplu-scorebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(0,0,0,.25);
  border-bottom: 1px solid var(--fplu-card-border);
}

.fplu-team-name {
  font-size: 15px;
  font-weight: 700;
  min-width: 100px;
}

.fplu-team-name.home { text-align: right; }
.fplu-team-name.away { text-align: left; }

.fplu-score {
  font-size: 22px;
  font-weight: 900;
  min-width: 70px;
  text-align: center;
  letter-spacing: 2px;
}

.fplu-score .fplu-vs {
  font-size: 13px;
  font-weight: 600;
  color: var(--fplu-muted);
  letter-spacing: 0;
}

.fplu-kickoff-time {
  font-size: 12px;
  color: var(--fplu-muted);
  text-align: center;
  margin-top: 2px;
}

.fplu-match-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  margin-top: 2px;
}

.fplu-match-status.live {
  color: var(--fplu-red);
}

.fplu-match-status.ft {
  color: var(--fplu-muted);
}

/* ─── Pitch ─── */

.fplu-pitch-wrap {
  position: relative;
  display: flex;
}

.fplu-pitch-half {
  flex: 1;
  position: relative;
  padding: 16px 8px;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: repeating-linear-gradient(
    180deg,
    var(--fplu-pitch) 0,
    var(--fplu-pitch) 50%,
    var(--fplu-pitch-light) 50%,
    var(--fplu-pitch-light) 100%
  );
  background-size: 100% 25%;
}

.fplu-pitch-half.home {
  border-right: 2px solid var(--fplu-pitch-line);
}

/* Pitch markings */
.fplu-pitch-half::before {
  content: '';
  position: absolute;
  bottom: 0;
  width: 44%;
  height: 22%;
  border: 2px solid var(--fplu-pitch-line);
  border-bottom: none;
  pointer-events: none;
}

.fplu-pitch-half.home::before {
  right: 0;
  border-right: none;
}

.fplu-pitch-half.away::before {
  left: 0;
  border-left: none;
}

/* Center circle hint */
.fplu-pitch-wrap::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  border: 2px solid var(--fplu-pitch-line);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Position rows */
.fplu-pos-row {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* ─── Player Dot ─── */

.fplu-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 64px;
  cursor: default;
  position: relative;
}

.fplu-player-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: #111;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  transition: transform .15s;
}

.fplu-player:hover .fplu-player-circle {
  transform: scale(1.15);
}

.fplu-player-circle .fplu-pos-label {
  font-size: 10px;
  font-weight: 800;
}

.fplu-player-name {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
  max-width: 62px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Event badges on player circle */
.fplu-badge {
  position: absolute;
  font-size: 8px;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

.fplu-badge-goal {
  top: -4px;
  right: -4px;
  background: var(--fplu-goal);
  color: #000;
}

.fplu-badge-assist {
  top: -4px;
  left: -4px;
  background: #42a5f5;
  color: #fff;
}

.fplu-badge-yellow {
  bottom: -4px;
  left: -4px;
  background: var(--fplu-yellow);
  color: #000;
}

.fplu-badge-red {
  bottom: -4px;
  left: -4px;
  background: var(--fplu-red);
  color: #fff;
}

.fplu-badge-bonus {
  bottom: -4px;
  right: -4px;
  background: var(--fplu-bonus);
  color: #fff;
}

/* Player points */
.fplu-player-pts {
  font-size: 9px;
  font-weight: 700;
  color: var(--fplu-accent);
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}

/* ─── Tooltip ─── */

.fplu-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,16,30,.95);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 140px;
  z-index: 100;
  pointer-events: none;
  white-space: nowrap;
}

.fplu-player:hover .fplu-tooltip {
  display: block;
}

.fplu-tooltip-name {
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.fplu-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--fplu-muted);
  line-height: 1.7;
}

.fplu-tooltip-row span:last-child {
  color: #fff;
  font-weight: 600;
}

/* ─── Bench ─── */

.fplu-bench-section {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--fplu-card-border);
  background: rgba(0,0,0,.2);
}

.fplu-bench-half {
  flex: 1;
  padding: 10px 12px;
}

.fplu-bench-half + .fplu-bench-half {
  border-left: 1px solid var(--fplu-card-border);
}

.fplu-bench-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--fplu-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.fplu-bench-players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fplu-bench-player {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,.08);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--fplu-muted);
}

.fplu-bench-player .fplu-sub-mins {
  font-size: 9px;
  color: var(--fplu-accent);
  margin-left: 3px;
}

/* ─── Not Started State ─── */

.fplu-not-started {
  text-align: center;
  padding: 50px 20px;
  color: var(--fplu-muted);
  font-size: 13px;
}

.fplu-not-started .fplu-countdown {
  font-size: 16px;
  font-weight: 700;
  color: var(--fplu-text);
  margin-bottom: 4px;
}

/* ─── Responsive ─── */

@media (max-width: 600px) {
  .fplu-team-name {
    font-size: 13px;
    min-width: 70px;
  }

  .fplu-score {
    font-size: 18px;
    min-width: 50px;
  }

  .fplu-pitch-half {
    min-height: 300px;
    padding: 12px 4px;
  }

  .fplu-player {
    width: 48px;
  }

  .fplu-player-circle {
    width: 30px;
    height: 30px;
    font-size: 9px;
  }

  .fplu-player-name {
    font-size: 8px;
    max-width: 46px;
  }

  .fplu-badge {
    width: 13px;
    height: 13px;
    font-size: 7px;
  }

  .fplu-tooltip {
    min-width: 120px;
    padding: 8px 10px;
    font-size: 10px;
  }
}
