/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700&family=Barlow:wght@400;500&display=swap');

/* ── CSS variables ── */
:root {
  --bg:       #fafafa;
  --surface:  #f4f4f5;
  --border:   #e4e4e7;
  --text:     #09090b;
  --muted:    #3f3f46;
  --green:    #10b981;
  --green-dk: #059669;
  --coral:    #ff4d6d;
  --amber:    #f59e0b;
  --sky:      #38bdf8;
  --pitch:    #22c55e;
  --pitch-dk: #16a34a;

  /* ── Type scale ── */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;

  /* ── Spacing ── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* ── Squad selector design tokens ── */
  --ss-bg:            #f4f4f5;
  --ss-border:        #e4e4e7;
  --ss-green:         #059669;
  --ss-green-light:   #d1fae5;
  --ss-red:           #be123c;
  --ss-red-light:     #fee2e2;
  --ss-card-radius:   14px;
  --ss-badge-gk:      #F97316;
  --ss-badge-def:     #3B82F6;
  --ss-badge-mid:     #22C55E;
  --ss-badge-fwd:     #F59E0B;
  --ss-font-cond:     'Barlow Condensed', sans-serif;
  --ss-font-body:     'Barlow', sans-serif;
}

/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
html, body { overflow-x: hidden; max-width: 100%; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Nav ── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.nav-logo svg {
  display: block;
  flex-shrink: 0;
}

.nav-logo-wordmark {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #1a1a1a;
}

.nav-logo-accent {
  color: #10b981;
}

.nav-beta-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  background: #f97316;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.4;
  align-self: center;
}

/* ── Hamburger (visible on mobile only) ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 1001;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ── Nav overlay (mobile backdrop) ── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}
.nav-overlay.open { display: block; }

/* ── Nav links ── */
.nav-links { display: flex; gap: 8px; align-items: center; }

@media (max-width: 767px) {
  .nav-hamburger { display: flex; }

  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 240px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 72px 20px 32px;
    background: var(--bg);
    border-left: 1px solid var(--border);
    z-index: 1000;
    overflow-y: auto;
  }
  .nav-links.open { display: flex; }

  .nav-link, .nav-link-admin, .nav-link-logout {
    width: 100%;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
  }
}

@media (min-width: 768px) {
  .nav-hamburger { display: none; }
  .nav-links { display: flex; flex-direction: row; position: static; width: auto; padding: 0; border: none; background: none; }
}

.nav-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: var(--surface);
  padding: 7px 16px;
  border-radius: 100px;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--text); color: #fff; }
.nav-link.active { background: var(--text); color: #fff; }

.nav-link-admin {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  background: var(--amber);
  padding: 7px 16px;
  border-radius: 100px;
  transition: opacity 0.15s;
}
.nav-link-admin:hover { opacity: 0.85; }
.nav-link-admin.active { opacity: 0.85; }

.nav-link-logout {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: var(--surface);
  padding: 7px 16px;
  border-radius: 100px;
  transition: background 0.15s, color 0.15s;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.nav-link-logout:hover { background: #ffe4e6; color: #be123c; }

.nav-form { display: inline; }

/* ── Alerts ── */
.alert {
  font-size: 12px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
}
.alert-error   { background: #ffe4e6; color: #be123c; }
.alert-success { background: #dcfce7; color: #15803d; }

/* ── Form elements ── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 11px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: var(--text); }

/* ── Buttons ── */
.btn-primary {
  padding: 10px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--text);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.85; }

.btn-danger {
  padding: 10px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #be123c;
  background: #ffe4e6;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-danger:hover { opacity: 0.85; }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 10px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: border-color 0.15s;
}
.btn-ghost:hover { border-color: #c0c0c0; }

.btn-lg {
  padding: 14px 28px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  min-height: 44px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  transition: opacity 0.15s, background 0.15s;
  font-family: 'DM Sans', sans-serif;
}

/* ── Position pills ── */
.pos-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}
.pos-GK  { background: #fff3cd; color: #b45309; }
.pos-DEF { background: #dbeafe; color: #1d4ed8; }
.pos-MID { background: #dcfce7; color: #15803d; }
.pos-FWD { background: #ffe4e6; color: #be123c; }

/* ── Roster search ── */
.roster-search {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  box-sizing: border-box;
  margin-top: 8px;
}
.roster-search::placeholder { color: var(--muted); }
.roster-search:focus { border-color: var(--muted); }

/* ── Recommendation badges ── */
.rec-BUY     { background: #dcfce7; color: #15803d; }
.rec-SELL    { background: #ffe4e6; color: #be123c; }
.rec-CAPTAIN { background: #fef9c3; color: #854d0e; }
.rec-HOLD    { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }

/* ── Premier League table ── */
.pl-table { width: 100%; border-collapse: collapse; }
.pl-table th {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  text-align: right;
  padding: 0 0 6px 4px;
}
.pl-table th:first-child { text-align: left; padding-left: 0; }
.pl-table td {
  font-size: 11px;
  padding: 5px 0 5px 4px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: middle;
}
.pl-table tr:last-child td { border-bottom: none; }
.pl-table td:first-child { text-align: left; padding-left: 0; }
.pl-pos {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  width: 14px;
  display: inline-block;
}
.pl-pos.zone-cl  { color: #2563eb; font-weight: 700; }
.pl-pos.zone-el  { color: #f97316; font-weight: 700; }
.pl-pos.zone-rel { color: #ef4444; font-weight: 700; }
.pl-team-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.pl-team-link:hover { color: var(--green-dk); }
.pl-record { font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; }
.pl-pts    { font-weight: 700; font-family: 'DM Mono', monospace; }

/* ── Pitch visualization ── */
.pitch-wrap {
  position: relative;
  width: 100%;
  background: var(--pitch);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(34,197,94,0.2);
}
.pitch-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0, transparent 50px,
    rgba(0,0,0,0.04) 50px, rgba(0,0,0,0.04) 100px
  );
  border-radius: 12px;
  pointer-events: none;
}
.pitch-lines { position: absolute; inset: 0; pointer-events: none; }
.pitch-lines svg { width: 100%; height: 100%; }
.player-token {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 2;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.token-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  border: 2px solid rgba(255,255,255,0.9);
  transition: transform 0.15s;
}
.token-circle:hover { transform: scale(1.1); }
.token-circle.gk { background: var(--amber); }
.token-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8);
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.token-opponent {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* ── Locked paywall overlays ── */
.locked-placeholder {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}
.locked-blur-content {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
  opacity: 0.6;
}
.locked-dummy-card {
  height: 64px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}
.locked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255,255,255,0.75);
}
.locked-icon { display: flex; align-items: center; justify-content: center; }
.locked-label { font-size: 11px; font-weight: 700; color: var(--text); }
.locked-cta {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--text);
  padding: 6px 16px;
  border-radius: 100px;
  text-decoration: none;
}
.locked-cta:hover { opacity: 0.85; }

/* ── Skeleton loading shimmer ── */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
#player-detail-panel.htmx-request {
  position: relative;
  min-height: 200px;
  pointer-events: none;
}
#player-detail-panel.htmx-request > * { visibility: hidden; }
#player-detail-panel.htmx-request::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

/* ── Empty states ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
}
.empty-state-icon { font-size: 28px; line-height: 1; }
.empty-state-msg  { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ── Checkbox label ── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

/* ── Muted small text utility ── */
.text-muted-sm { font-size: 12px; color: var(--muted); }

/* ── Show more button ── */
.show-more-btn {
  display: block;
  margin: 12px auto 0;
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.show-more-btn:hover {
  background: var(--bg);
  color: var(--text);
}
.show-more-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}


/* ── Differential badge ── */
.differential-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--amber);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
  line-height: 1;
}
