/* ==========================================================================
   Tournament hub header (Views/Tournament/_TournamentHubHeader.cshtml), drawn on top of every EventDetails hub page
   (above the tab strip, see _TeamTournamentTabs.cshtml). Theme tokens only (theme-v2.css) - no literal colours. Rows:
     rpv-head      tournament hero | sponsors grid  (two columns from 768px, stacked below; hero alone without sponsors)
     rpv-progress  registration progress, own full-width row
   The banner carries the Copy link + Check-in buttons (.rpv-banner__actions, markup _HeroActions) the start-date block, the status chip (.rpv-status) and the ID tag.
   Class names keep the rpv- prefix of the page they were born in (registration-pair-v2.css, which still owns the form below).
   ========================================================================== */

/* wrapper also carries .full-width-layout (layout-v2.css breakout: leaves the centre grid track, 16px side gutter) */
.rpv-hubhead {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 12px;
    margin-bottom: 14px;
    color: var(--color-text-primary);
    font-family: var(--font-family-base);
    box-sizing: border-box;
}

.rpv-hubhead *,
.rpv-hubhead *::before,
.rpv-hubhead *::after { box-sizing: border-box; }

.rpv-hubhead [hidden] { display: none !important; }

/* header row: hero | sponsors (stacked on mobile; the hero alone when there are no sponsors) */
.rpv-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}

/* card surface (also used by the registration form cards of registration-pair-v2.css) */
.rpv-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 12px 16px;
}

/* ---- banner ---- */
/* no overflow:hidden - the events dropdown menu hangs below the card (z-index lifts it over the progress row) */
.rpv-banner {
    position: relative;
    z-index: 3;
    min-height: 150px;
    padding: 0;
    background-color: var(--color-surface);
    background-size: cover;
    background-position: right center;
    background-repeat: no-repeat;
}

.rpv-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--color-surface) 38%, transparent 100%);
}

.rpv-banner__body {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    max-width: 70%;
    padding: 12px 16px;
}

.rpv-banner__main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

/* start-date block (weekday / day / month) */
.rpv-banner__date {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 58px;
    padding: 6px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--card-radius);
    background: var(--color-surface-secondary);
    line-height: 1.15;
    text-align: center;
}

.rpv-banner__date span,
.rpv-banner__date em { font-size: var(--font-size-sm); font-style: normal; font-weight: 700; color: var(--color-text-secondary); }
.rpv-banner__date strong { font-size: 26px; font-weight: 800; color: var(--color-primary); }

.rpv-sport {
    display: inline-block;
    padding: 2px 12px;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-pill);
    color: var(--color-primary);
    background: var(--color-surface-secondary);
    font-size: var(--font-size-md);
    font-weight: 700;
}

.rpv-title {
    margin: 0;
    font-family: var(--font-family-heading);
    font-size: clamp(22px, 2.3vw, 30px);
    line-height: 1.15;
    font-weight: 800;
    color: var(--color-text-primary);
    overflow-wrap: anywhere;
}

.rpv-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
}

.rpv-meta__item { display: inline-flex; align-items: center; gap: 8px; }
.rpv-meta__item i { color: var(--color-primary); }

.rpv-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }

.rpv-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface-secondary);
    color: var(--color-text-secondary);
    font-size: var(--font-size-md);
    text-decoration: none;
    white-space: nowrap;
}

.rpv-chip:hover { border-color: var(--color-primary); color: var(--color-text-primary); }
.rpv-chip.is-current { border-color: var(--color-primary); color: var(--color-primary); }
/* events dropdown: the button is a chip, the menu floats over the progress row below */
.rpv-evdd { position: relative; display: inline-block; max-width: 100%; }

.rpv-evdd__btn { gap: 8px; font-family: inherit; cursor: pointer; }
.rpv-evdd__btn:focus-visible,
.rpv-evdd__item:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.rpv-evdd__label { overflow: hidden; text-overflow: ellipsis; }

.rpv-evdd__count {
    min-width: 20px;
    padding: 0 6px;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    font-size: var(--font-size-sm);
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.rpv-evdd__caret { font-size: var(--font-size-sm); }
.rpv-evdd.is-open .rpv-evdd__caret { transform: rotate(180deg); }

.rpv-evdd__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    min-width: 100%;
    max-width: min(360px, 86vw);
    max-height: 60vh;
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--card-radius);
    background: var(--color-surface);
    box-shadow: var(--card-shadow);
}

.rpv-evdd__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--card-radius);
    color: var(--color-text-secondary);
    font-size: var(--font-size-md);
    text-decoration: none;
    white-space: nowrap;
}

.rpv-evdd__item:hover { background: var(--color-surface-secondary); color: var(--color-text-primary); }
.rpv-evdd__item.is-current { color: var(--color-primary); font-weight: 700; }
.rpv-evdd__item--all { margin-top: 4px; border-top: 1px solid var(--color-border); border-radius: 0 0 var(--card-radius) var(--card-radius); color: var(--color-text-muted); }

/* ---- sponsors (static: every logo visible) ---- */
.rpv-sponsors {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 10px;
}

.rpv-sponsors__label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    flex: 0 0 auto;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text-primary);
}

.rpv-sponsors__label i { color: var(--color-primary); }

.rpv-sponsors__grid {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    align-content: start;   /* the card is as tall as the hero: keep the logo rows at their own height */
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rpv-sponsor { min-width: 0; }

.rpv-sponsor > a,
.rpv-sponsor__plain {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 4px 8px;
    border: 1px solid var(--logo-plate-border);
    border-radius: 8px;
    background: var(--logo-plate-bg);
    overflow: hidden;
    text-decoration: none;
}

.rpv-sponsor img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.rpv-sponsor span {
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-align: center;
    color: var(--color-text-inverse);
    overflow-wrap: anywhere;
}

/* ---- progress ---- */
.rpv-progress {
    border-color: var(--color-primary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rpv-progress__top { display: flex; align-items: center; gap: 14px; }

.rpv-progress__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-circle);
    background: var(--color-surface-secondary);
    color: var(--color-primary);
    font-size: 20px;
}

.rpv-progress__head { flex: 1 1 auto; min-width: 0; }

.rpv-progress__title {
    margin: 0;
    font-family: var(--font-family-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-primary);
}

.rpv-progress__sub { font-size: var(--font-size-md); color: var(--color-text-secondary); }

.rpv-progress__stats { display: flex; align-items: stretch; flex: 0 0 auto; }

.rpv-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    padding: 0 16px;
    border-left: 1px solid var(--color-border);
    text-align: center;
}

.rpv-stat__label { font-size: var(--font-size-md); color: var(--color-text-secondary); }
.rpv-stat__value { font-size: var(--font-size-lg); color: var(--color-text-secondary); }
.rpv-stat__value strong { font-size: 26px; font-weight: 800; color: var(--color-text-primary); }
.rpv-stat:first-child .rpv-stat__value strong { color: var(--color-primary); }

.rpv-bar { display: flex; align-items: center; gap: 14px; }

.rpv-bar__track {
    flex: 1 1 auto;
    height: 10px;
    border-radius: var(--radius-pill);
    background: var(--color-border);
    overflow: hidden;
}

.rpv-bar__fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
}

.rpv-bar.is-nolimit .rpv-bar__fill { width: 0 !important; }
.rpv-bar__pct { flex: 0 0 auto; min-width: 44px; text-align: right; font-size: var(--font-size-lg); color: var(--color-text-secondary); }

/* banner buttons (Copy link + Check-in): top-right over the banner, on their own plate so the poster art never hides the labels */
.rpv-banner__actions {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    display: flex;
    gap: 8px;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    background: var(--color-surface);
}

.rpv-banner__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* status chip next to the sport chip; Live pulses */
.rpv-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface-secondary);
    color: var(--color-text-secondary);
    font-size: var(--font-size-md);
    font-weight: 700;
}

.rpv-status[data-status="Live"] { border-color: var(--color-danger); background: var(--color-danger); color: var(--color-text-inverse); }
.rpv-status[data-status="Upcoming"] { border-color: var(--color-info); color: var(--color-info); }
.rpv-status[data-status="Completed"] { color: var(--color-text-muted); }

.rpv-status[data-status="Live"]::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: var(--radius-circle);
    background: currentColor;
}

.rpv-idtag {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: 700;
}

/* ---- tablet and up: hero | sponsors ---- */
@media (min-width: 768px) {
    .rpv-head:not(.rpv-head--solo) { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

/* ---- mobile ---- */
@media (max-width: 767px) {
    .rpv-card { padding: 10px 12px; }
    .rpv-banner { min-height: 0; }
    .rpv-banner::before { background: linear-gradient(90deg, var(--color-surface) 55%, transparent 100%); }
    .rpv-banner__body { max-width: 100%; padding: 10px 12px; }
    .rpv-title { font-size: 22px; }
    .rpv-meta { font-size: var(--font-size-md); gap: 2px 14px; }
    .rpv-chip { padding: 2px 10px; font-size: var(--font-size-sm); }

    .rpv-sponsors { gap: 8px; }
    .rpv-sponsors__label { justify-content: center; }
    .rpv-sponsors__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .rpv-sponsor > a,
    .rpv-sponsor__plain { height: 40px; padding: 3px 6px; }

    .rpv-progress__top { flex-wrap: wrap; gap: 10px; }
    .rpv-progress__icon { width: 38px; height: 38px; font-size: 17px; }
    .rpv-progress__title { font-size: var(--font-size-xl); }
    .rpv-progress__stats { flex: 1 1 100%; justify-content: space-around; }
    .rpv-stat { min-width: 72px; padding: 0 10px; }
    .rpv-stat__value strong { font-size: 22px; }
    .rpv-hubhead { padding-top: 8px; margin-bottom: 10px; gap: 10px; }
    /* buttons leave the corner and sit under the title row so they never cover it */
    .rpv-banner__actions { position: relative; width: fit-content; margin: 10px 12px 0; }
    .rpv-banner__body { padding-top: 16px; gap: 10px; } /* the plate above overlaps the body's top edge by ~10px */
    .rpv-banner__date { min-width: 48px; padding: 4px 8px; }
    .rpv-banner__date strong { font-size: 22px; }
}

@media (prefers-reduced-motion: no-preference) {
    .rpv-bar__fill { transition: width .4s ease; }
}
