/* The sport picker on the sign-up's sport step and the team page's Sport row (EQU-1200),
   as equipo-documentation's reference/design-system-components.md#sport-picker specifies it.
   Markup: views/includes/sport_picker.php. */
:root {
    --equipo-50: #f5f3ff;
    --equipo-200: #ddd6fe;
    --equipo-300: #c4b5fd;
    --equipo-500: #8b5cf6;
    --equipo-700: #6d28d9;
}

/* The pager buttons and rows set their own display, which would otherwise beat [hidden]. */
.ts-sport-picker [hidden] {
    display: none;
}

.ts-sport-search {
    position: relative;
    margin-bottom: 16px;
}

/* text-secondary, not text-tertiary: the placeholder is all that says what the field is for,
   and text-tertiary is 2.5:1 on white. */
.ts-sport-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    color: #4b5563;
    pointer-events: none;
}

.ts-sport-search input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    background: #ffffff;
    border: 2px solid #f3f4f6;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    color: #111827;
    transition: border-color 0.2s ease;
}

.ts-sport-search input:focus {
    outline: none;
    border-color: var(--equipo-300);
}

.ts-sport-search input::placeholder,
.ts-sport-row-input input::placeholder {
    color: #4b5563;
}

/* Rows rather than a wall of pills, paged sideways rather than scrolled down, so the picker
   keeps the same height however long the list is. */
.ts-sport-pager {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ts-sport-pager::-webkit-scrollbar {
    display: none;
}

.ts-sport-page {
    flex: 0 0 100%;
    scroll-snap-align: start;
}

/* Searching drops the paging: a hit on page three is a hit nobody can see, so every match
   stacks into one list until the query is gone. */
.ts-sport-pager.searching {
    display: block;
    overflow-x: visible;
}

.ts-sport-pager.searching .ts-sport-page {
    margin-bottom: 16px;
}

/* Typing a sport of your own sits under the pager, reachable from every page. */
.ts-sport-own {
    margin-top: 8px;
}

/* Three fixed slots, so the dots stay centred whether or not the page buttons show. */
.ts-sport-pager-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

/* Explicit columns: a hidden page button is not placed at all, and without these the dots
   would slide over into the empty slot. */
.ts-sport-prev {
    grid-column: 1;
    justify-self: start;
}

.ts-sport-next {
    grid-column: 3;
    justify-self: end;
}

.ts-sport-dots {
    grid-column: 2;
    display: flex;
    gap: 8px;
}

.ts-sport-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    background: #d1d5db;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.2s ease, width 0.2s ease;
}

.ts-sport-dot[aria-current="true"] {
    width: 20px;
    background: var(--equipo-500);
}

.ts-sport-more {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    background: none;
    border: none;
    color: var(--equipo-700);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
}

.ts-sport-page-title {
    margin: 0 0 8px 4px;
    color: #4b5563;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ts-sport-list {
    background: #ffffff;
    border: 1px solid #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
}

.ts-sport-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    border-top: 1px solid #f3f4f6;
    color: #111827;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    transition: background-color 0.15s ease;
}

/* The divider belongs between rows, so whichever row is topmost after filtering drops it (a
   plain :first-child rule breaks as soon as rows are hidden). */
.ts-sport-row.first-visible {
    border-top: none;
}

.ts-sport-row:hover {
    background: #f9fafb;
}

.ts-sport-row:focus-visible {
    outline: 2px solid var(--equipo-500);
    outline-offset: -2px;
}

.ts-sport-row.selected {
    background: var(--equipo-50);
    color: var(--equipo-700);
    font-weight: 600;
}

.ts-sport-row.selected::after {
    content: '\2713';
    margin-left: auto;
    color: var(--equipo-500);
    font-weight: 700;
}

.ts-sport-row-icon {
    flex: 0 0 24px;
    font-size: 1.25rem;
    line-height: 1;
    text-align: center;
}

/* Escape hatch for a sport that is not in the list at all. The typed field takes the row's
   place, so the row keeps its height and nothing below it moves. */
.ts-sport-row-other {
    color: var(--equipo-700);
}

.ts-sport-row-input {
    cursor: text;
}

.ts-sport-row-input input {
    flex: 1;
    min-width: 0;
    padding: 0;
    background: none;
    border: none;
    color: #111827;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.ts-sport-row-input input:focus {
    outline: none;
}

.ts-sport-add .ts-sport-row {
    background: #ffffff;
    border: 1px solid var(--equipo-200);
    border-radius: 12px;
    color: var(--equipo-700);
}

.ts-sport-add .ts-sport-row:hover {
    background: var(--equipo-50);
}

@media (max-width: 380px) {
    .ts-sport-row {
        padding: 8px 12px;
        font-size: 0.875rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ts-sport-dot,
    .ts-sport-row {
        transition: none;
    }
}
