/* ============================================================
   HEAD TO HEAD ("Cara a Cara") MODULE — ATLETIKA
   Same bottom-sheet language as the Add Athlete picker (aa-*),
   its own prefix since the content is completely different.
   Class prefix: h2h-
   ============================================================ */

.h2h-overlay {
  position: fixed; bottom: 0; left: 0; right: 0; top: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.h2h-overlay--open { display: flex; }

.h2h-sheet {
  background: #fff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 600px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: h2hSlideUp 0.35s ease-out;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}
@keyframes h2hSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ---------- Handle: drag bar (mobile affordance) + close X (desktop) --
   identical structure to Add Athlete's .aa-handle, same reason: a
   centered bar via auto-margins between two flex items, so it works out
   to "bar dead center, X pinned top-right" with no extra markup. ---------- */
.h2h-handle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 8px;
  flex-shrink: 0;
}
.h2h-handle__bar { width: 36px; height: 4px; border-radius: 2px; background: #cbd5e1; margin: 0 auto; }
.h2h-handle__close {
  width: 28px; height: 28px; border-radius: 50%;
  background: #f1f5f9; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #64748b; font-size: 14px;
  position: absolute; right: 16px;
}
.h2h-handle__close:hover { background: #e2e8f0; color: #1e293b; }
.h2h-handle { position: relative; }
.h2h-title { text-align: center; font-size: 14px; font-weight: 800; color: #1e293b; padding: 0 16px 10px; flex-shrink: 0; }

/* Mobile: drag bar only (it's also the swipe-to-dismiss handle -- see
   initSheetDrag in head2head.js). Desktop: no drag gesture, so the X is
   what you get instead. Same 768px split as Add Athlete. */
@media (min-width: 768px) {
  .h2h-handle__bar { display: none; }
}
@media (max-width: 767px) {
  .h2h-handle__close { display: none; }
}

/* ---------- Trigger link (discreet -- a small text link, not a filled
   button, and never inside the team-info card itself) ---------- */
.h2h-launch-row { display: flex; margin: 8px 0 2px; }
.h2h-launch-row--right { justify-content: flex-end; }
.h2h-launch-row--left { justify-content: flex-start; }
.h2h-trigger {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; color: #94a3b8;
  cursor: pointer; padding: 4px 8px;
}
.h2h-trigger:hover { color: #64748b; }

/* ---------- Scroll container: the ONE flex child that actually grows +
   scrolls, shared by both the picker and comparison views. ---------- */
#h2hContent { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Picker view (My Team entry point only) ---------- */
.h2h-picker { padding: 0 16px 16px; }
.h2h-picker__search {
  width: 100%; box-sizing: border-box;
  padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px;
  font-size: 14px; margin-bottom: 10px;
}
.h2h-picker__search:focus { outline: none; border-color: #d4562a; }
.h2h-picker__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 12px; cursor: pointer;
  background: #fff; border: 1px solid #e2e8f0; margin-bottom: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.h2h-picker__item:hover { border-color: #cbd5e1; box-shadow: 0 4px 12px rgba(15,23,42,0.08); }
.h2h-picker__info { flex: 1; min-width: 0; }
.h2h-picker__name { font-size: 13px; font-weight: 700; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h-picker__meta { font-size: 11px; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h-picker__arrow { flex-shrink: 0; color: #cbd5e1; font-size: 14px; }
.h2h-picker__empty { text-align: center; color: #94a3b8; font-size: 13px; padding: 24px 0; }

/* ---------- Comparison view ---------- */
.h2h-body { padding: 0 16px 20px; }

/* Sticky against #h2hContent (the actual scroller) so the two teams and
   their points stay on screen the whole time you're scrolling through
   the comparison rows below -- the whole point of the header. */
.h2h-teams {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 0 14px;
  position: sticky; top: 0; z-index: 5;
  background: #fff;
}
.h2h-teams::after {
  content: ''; position: absolute; left: -16px; right: -16px; bottom: 0;
  height: 1px; background: #f1f5f9;
}
.h2h-team { flex: 1; min-width: 0; text-align: center; }
.h2h-team--mine { text-align: left; }
.h2h-team--other { text-align: right; }
.h2h-team__name { font-size: 13px; font-weight: 800; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h2h-team__pts { font-size: 20px; font-weight: 800; color: #d4562a; }
.h2h-teams__vs { flex-shrink: 0; font-size: 11px; font-weight: 800; color: #94a3b8; padding: 0 6px; }

.h2h-section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase; color: #94a3b8;
  letter-spacing: 0.03em; margin: 14px 0 6px;
}

/* Identical athletes: single compact row, not a comparison */
.h2h-same-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 8px; background: #f8fafc;
  margin-bottom: 4px;
}
.h2h-same-row .h2h-flag { width: 18px; height: 13px; border-radius: 2px; flex-shrink: 0; object-fit: cover; }
.h2h-same-row__name { font-size: 12px; font-weight: 700; color: #1e293b; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h-same-row__price { font-size: 11px; font-weight: 700; color: #64748b; flex-shrink: 0; }
/* Same styling as My Team's own .ac14b-pts (bold, brand orange) -- the
   dash placeholder for "no result yet" inherits that same color instead
   of the muted gray used elsewhere for missing data, per how points are
   always colored regardless of tier. */
.h2h-same-row__pts { font-size: 15px; font-weight: 900; color: var(--color-primary); flex-shrink: 0; min-width: 26px; text-align: right; }
.h2h-same-row__pts small { font-size: 8px; font-weight: 700; text-transform: uppercase; margin-left: 2px; }

/* Pair row: two athlete mini-cards + a thin center icon */
.h2h-row {
  display: grid; grid-template-columns: 1fr 28px 1fr;
  align-items: stretch; gap: 6px;
  padding: 5px 0;
}

.h2h-card {
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 8px 26px 7px; min-height: 62px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  min-width: 0;
}
.h2h-card--win { border-color: #86efac; background: #f0fdf4; }
.h2h-card--empty { opacity: 0.4; justify-content: center; }
.h2h-card--empty .h2h-card__name { font-style: italic; }

.h2h-card__price {
  position: absolute; top: 6px;
  font-size: 10px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: 999px; padding: 2px 6px; white-space: nowrap;
}
.h2h-card--mine .h2h-card__price { left: 6px; }
.h2h-card--other .h2h-card__price { right: 6px; }

.h2h-flag { width: 22px; height: 16px; border-radius: 3px; object-fit: cover; margin-bottom: 3px; }
.h2h-card__name { font-size: 11px; font-weight: 800; color: #1e293b; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h-card--win .h2h-card__name { color: #16a34a; }
.h2h-card__event { font-size: 9px; color: #94a3b8; margin: 1px 0 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h-card__pts { font-size: 14px; font-weight: 800; color: #64748b; }
.h2h-card--win .h2h-card__pts { color: #16a34a; }
.h2h-card__pts small { font-size: 8px; font-weight: 700; text-transform: uppercase; margin-left: 2px; }

.h2h-center { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.h2h-center__icon { font-size: 13px; }

.h2h-empty-state { text-align: center; color: #94a3b8; font-size: 13px; padding: 30px 0; }

/* ---------- Small screens: same info, tighter ---------- */
@media (max-width: 380px) {
  .h2h-card { padding: 7px 20px 6px; min-height: 56px; }
  .h2h-card__event { display: none; }
  .h2h-team__pts { font-size: 17px; }
}
