/* ============================================================
   Esports Hover Cards — HLTV-inspired dark theme
   ============================================================ */

/* ── Custom properties ────────────────────────────────────── */
:root {
  --ehc-bg:           #1a1c20;
  --ehc-bg-deep:      #13151a;
  --ehc-bg-elevated:  #22252c;
  --ehc-border:       #2e3139;
  --ehc-border-glow:  #f5a623;
  --ehc-text:         #e0e2e8;
  --ehc-text-muted:   #7c8290;
  --ehc-text-dim:     #50545f;
  --ehc-accent:       #f5a623;           /* HLTV orange */
  --ehc-accent-blue:  #4fc3f7;
  --ehc-green:        #4caf81;
  --ehc-red:          #e05c6b;
  --ehc-yellow:       #e0b84d;
  --ehc-radius:       6px;
  --ehc-shadow:       0 8px 32px rgba(0,0,0,.65), 0 2px 8px rgba(0,0,0,.4);
  --ehc-w:            280px;
  --ehc-font:         'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
}

/* ── Trigger spans ────────────────────────────────────────── */
.ehc-trigger {
  color: var(--ehc-accent);
  border-bottom: 1px dotted currentColor;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.ehc-trigger:hover,
.ehc-trigger:focus-visible {
  color: #ffd080;
  border-bottom-style: solid;
  outline: none;
}
.ehc-trigger--player { color: var(--ehc-accent); }
.ehc-trigger--player:hover { color: #ffd080; }

/* ── Card base ────────────────────────────────────────────── */
.ehc-card {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 99999;
  width: var(--ehc-w);
  font-family: var(--ehc-font);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ehc-text);
  background: var(--ehc-bg);
  border: 1px solid var(--ehc-border);
  border-radius: var(--ehc-radius);
  box-shadow: var(--ehc-shadow);
  pointer-events: none;           /* off by default */

  /* Hidden state */
  opacity: 0;
  transform: translateY(6px) scale(.98);
  transition:
    opacity      .18s ease,
    transform    .18s ease;
  will-change: transform, opacity;
}

/* Visible state */
.ehc-card--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Top accent line */
.ehc-card::before {
  content: '';
  display: block;
  height: 3px;
  border-radius: var(--ehc-radius) var(--ehc-radius) 0 0;
  background: var(--ehc-accent);
}
.ehc-card__inner--player::before { background: var(--ehc-accent-blue); }

/* ── Inner layout ─────────────────────────────────────────── */
.ehc-card__inner {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Header row ───────────────────────────────────────────── */
.ehc-card__header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* Team logo */
.ehc-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 3px;
  background: var(--ehc-bg-deep);
  padding: 3px;
}
.ehc-logo--placeholder {
  background: var(--ehc-bg-elevated);
  border: 1px dashed var(--ehc-border);
}

/* Player avatar */
.ehc-avatar {
  width: 48px;
  height: 48px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 4px;
  background: var(--ehc-bg-deep);
}
.ehc-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--ehc-text-muted);
  background: var(--ehc-bg-elevated);
  border: 1px solid var(--ehc-border);
  border-radius: 4px;
}
.ehc-avatar--team-fallback {
  object-fit: contain;
  background: var(--ehc-bg-deep);
  border: 1px solid var(--ehc-border);
  border-radius: 4px;
  padding: 4px;
}

/* Title block */
.ehc-card__title-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.ehc-card__name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ehc-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ehc-card__name:hover { color: var(--ehc-accent); text-decoration: underline; }
.ehc-card__inner--player .ehc-card__name:hover { color: var(--ehc-accent-blue); }

.ehc-card__fullname {
  font-size: 11px;
  color: var(--ehc-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ehc-card__country {
  font-size: 11px;
  color: var(--ehc-text-muted);
}

/* Badge */
.ehc-badge {
  flex-shrink: 0;
  align-self: flex-start;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 2px 5px;
  border-radius: 2px;
}
.ehc-badge--team   { background: rgba(245,166,35,.15); color: var(--ehc-accent); }
.ehc-badge--player { background: rgba(79,195,247,.15); color: var(--ehc-accent-blue); }

/* ── Team section label ───────────────────────────────────── */
.ehc-section__label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--ehc-text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ── Roster ───────────────────────────────────────────────── */
.ehc-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ehc-roster__player {
  font-size: 11px;
  font-weight: 600;
  color: var(--ehc-text-muted);
  background: var(--ehc-bg-elevated);
  border: 1px solid var(--ehc-border);
  border-radius: 3px;
  padding: 2px 7px;
  text-decoration: none;
  transition: color .12s, border-color .12s, background .12s;
}
.ehc-roster__player:hover {
  color: var(--ehc-accent);
  border-color: rgba(245,166,35,.4);
  background: rgba(245,166,35,.05);
}

/* ── Team link on player card ─────────────────────────────── */
.ehc-card__team {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ehc-text-muted);
  background: var(--ehc-bg-elevated);
  border-radius: 4px;
  padding: 5px 8px;
}
.ehc-card__team a {
  color: inherit;
  text-decoration: none;
}
.ehc-card__team a:hover { color: var(--ehc-accent-blue); }
.ehc-team-logo-sm {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ── Stats grid ───────────────────────────────────────────── */
.ehc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--ehc-border);
  border: 1px solid var(--ehc-border);
  border-radius: 4px;
  overflow: hidden;
}
.ehc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 4px;
  background: var(--ehc-bg-deep);
}
.ehc-stat__val {
  font-size: 15px;
  font-weight: 700;
  color: var(--ehc-text);
}
.ehc-stat__val--high { color: var(--ehc-green);  }
.ehc-stat__val--mid  { color: var(--ehc-yellow); }
.ehc-stat__val--low  { color: var(--ehc-red);    }
.ehc-stat__label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ehc-text-dim);
}

/* ── CTA link ─────────────────────────────────────────────── */
.ehc-card__cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--ehc-text-dim);
  text-decoration: none;
  padding-top: 6px;
  border-top: 1px solid var(--ehc-border);
  transition: color .12s;
}
.ehc-card__cta:hover { color: var(--ehc-accent); }
.ehc-card__inner--player .ehc-card__cta:hover { color: var(--ehc-accent-blue); }

.ehc-arrow {
  transition: transform .12s;
}
.ehc-card__cta:hover .ehc-arrow {
  transform: translateX(3px);
}

/* ── Loading & error states ───────────────────────────────── */
.ehc-card__loading,
.ehc-card__error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 14px;
  font-size: 12px;
  color: var(--ehc-text-muted);
}
.ehc-card__error { color: var(--ehc-red); }

/* Spinner */
.ehc-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--ehc-border);
  border-top-color: var(--ehc-accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: ehc-spin .7s linear infinite;
}
@keyframes ehc-spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive tweaks ────────────────────────────────────── */
@media ( max-width: 480px ) {
  :root { --ehc-w: calc(100vw - 24px); }
  .ehc-card { max-width: 360px; }
  .ehc-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Print: hide cards ────────────────────────────────────── */
@media print {
  .ehc-card, .ehc-trigger { all: revert; }
}

/* ============================================================
   FACEIT Section
   ============================================================ */

.ehc-faceit {
  background: #1c1816;
  border: 1px solid #2e2420;
  border-radius: 5px;
  overflow: hidden;
}

/* Header row: icon + label + link */
.ehc-faceit__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #221e1b;
  border-bottom: 1px solid #2e2420;
}

.ehc-faceit__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ehc-faceit__label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  color: #FF5500;
  text-transform: uppercase;
  flex: 1;
}

.ehc-faceit__link {
  font-size: 11px;
  color: #6b5f59;
  text-decoration: none;
  transition: color .12s;
}
.ehc-faceit__link:hover { color: #FF5500; }

/* Stats area */
.ehc-faceit__stats {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 10px;
}

/* ELO + Level block */
.ehc-faceit__elo-block {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 12px;
  margin-right: 12px;
  border-right: 1px solid #2e2420;
  flex-shrink: 0;
}

.ehc-faceit__level {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 900;
  color: #0d0c0b;
  flex-shrink: 0;
  line-height: 1;
}

.ehc-faceit__elo-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ehc-faceit__elo-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--ehc-text);
  line-height: 1;
}

.ehc-faceit__elo-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--ehc-text-dim);
  text-transform: uppercase;
}

/* 2×2 mini stats grid */
.ehc-faceit__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 8px;
  flex: 1;
}

.ehc-fstat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ehc-fstat__val {
  font-size: 13px;
  font-weight: 700;
  color: var(--ehc-text);
  line-height: 1;
}

.ehc-fstat__label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ehc-text-dim);
}

/* Widen card slightly when FACEIT section is present */
.ehc-card__inner--player:has(.ehc-faceit) {
  --ehc-w: 300px;
}

/* ── Empty stats state ──────────────────────────────────────────────────── */
.ehc-stats--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  background: var(--ehc-bg-deep);
  border: 1px solid var(--ehc-border);
  border-radius: 4px;
}
.ehc-stats__no-data {
  font-size: 10px;
  color: var(--ehc-text-dim);
  font-style: italic;
}
