/* ========================================
 * Team Browser — Two-Pane Split Layout
 * Sidebar team list + inline content panel
 * ======================================== */

/* ── Layout Shell ── */
.team-browser {
    display: grid;
    grid-template-columns: 320px 1fr;
    grid-template-rows: 1fr;
    height: calc(100vh - 60px); /* viewport minus navbar */
    overflow: hidden;
    position: relative;
}

/* ── Sidebar ── */
.team-browser__sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    background: var(--bg-primary);
    overflow: hidden;
}

.team-browser__sidebar-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 16px 16px 0;
    flex-shrink: 0;
}

.team-browser__title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.team-browser__count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Search */
.team-browser__search {
    position: relative;
    padding: 12px 16px 8px;
    flex-shrink: 0;
}

.team-browser__search-icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.8rem;
    pointer-events: none;
}

.team-browser__search-input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.team-browser__search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.team-browser__search-input:focus {
    border-color: var(--cta-primary);
    box-shadow: 0 0 0 3px rgba(var(--cta-primary-rgb, 59, 130, 246), 0.15);
}

/* Conference pills */
.team-browser__pills {
    display: flex;
    gap: 6px;
    padding: 4px 16px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 0;
    mask-image: linear-gradient(to right, transparent 0, #000 8px, #000 calc(100% - 16px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8px, #000 calc(100% - 16px), transparent 100%);
}

.team-browser__pills::-webkit-scrollbar {
    display: none;
}

.team-browser__pills .teams-pill {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.team-browser__pills .teams-pill-count {
    min-width: 18px;
    height: 16px;
    font-size: 0.65rem;
}

/* Team list */
.team-browser__list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

.team-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 16px 8px 0;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    font-family: inherit;
    transition: background-color 0.15s ease;
    position: relative;
    min-height: 48px;
}

.team-list-item:hover {
    background-color: var(--bg-card);
}

.team-list-item:focus-visible {
    outline: 2px solid var(--cta-primary);
    outline-offset: -2px;
    border-radius: 4px;
}

.team-list-item.active {
    background-color: var(--bg-card);
}

.team-list-item.active .team-list-item__accent {
    width: 4px;
}

.team-list-item__accent {
    width: 3px;
    align-self: stretch;
    flex-shrink: 0;
    border-radius: 0 2px 2px 0;
    transition: width 0.15s ease;
}

.team-list-item__logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Handle the <picture> wrapper from the macro */
.team-list-item picture {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.team-list-item picture img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.team-list-item__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.team-list-item__name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-list-item__conf {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hidden items (filtered out) */
.team-list-item.item-hidden {
    display: none;
}

/* Empty state */
.team-browser__empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
}

.team-browser__empty i {
    font-size: 1.5rem;
    opacity: 0.4;
    margin-bottom: 8px;
}

.team-browser__empty p {
    font-size: 0.85rem;
    margin: 0 0 12px;
}

.team-browser__empty-reset {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 16px;
    color: var(--cta-primary);
    font-size: 0.82rem;
    cursor: pointer;
}

.team-browser__empty-reset:hover {
    background-color: var(--bg-card);
}

/* ── Content Panel ── */
.team-browser__content {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    background: var(--bg-primary);
    position: relative;
}

/* Welcome state */
.team-browser__welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    gap: 8px;
}

.team-browser__welcome i {
    font-size: 3rem;
    opacity: 0.2;
}

.team-browser__welcome h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.team-browser__welcome p {
    margin: 0;
    font-size: 0.9rem;
}

/* Content fade transition */
.team-browser__content-inner {
    animation: tb-fadeIn 0.2s ease-out;
}

@keyframes tb-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Skeleton loader */
.team-browser__skeleton {
    animation: tb-fadeIn 0.15s ease-out;
}

.team-browser__skeleton-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.team-browser__skeleton-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: var(--bg-card);
    animation: tb-shimmer 1.2s ease-in-out infinite;
}

.team-browser__skeleton-text {
    flex: 1;
}

.team-browser__skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: var(--bg-card);
    animation: tb-shimmer 1.2s ease-in-out infinite;
    margin-bottom: 8px;
}

.team-browser__skeleton-line--title {
    width: 50%;
    height: 20px;
}

.team-browser__skeleton-line--sub {
    width: 30%;
}

.team-browser__skeleton-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.team-browser__skeleton-card {
    height: 180px;
    border-radius: 16px;
    background: var(--bg-card);
    animation: tb-shimmer 1.2s ease-in-out infinite;
}

.team-browser__skeleton-card--wide {
    grid-column: 1 / -1;
    height: 120px;
}

@keyframes tb-shimmer {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 0.7; }
}

/* Error state */
.team-browser__error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Partial wrapper header */
.team-partial__header {
    margin-bottom: 20px;
    position: relative;
}

.team-partial__header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 12px;
}

.team-partial__logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.team-partial__logo picture img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.team-partial__header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.team-partial__team-name {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.team-partial__conference {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.team-partial__header-accent {
    height: 3px;
    border-radius: 2px;
}

/* ── Mobile Back Button ── */
.team-browser__back {
    display: none;
    position: fixed;
    top: 68px;
    left: 12px;
    z-index: 100;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ── Responsive: Tablet ── */
@media (max-width: 1024px) {
    .team-browser {
        grid-template-columns: 280px 1fr;
    }
}

/* ── Responsive: Mobile ── */
@media (max-width: 768px) {
    .team-browser {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    .team-browser__sidebar {
        border-right: none;
    }

    .team-browser__content {
        position: absolute;
        inset: 0;
        z-index: 50;
        transform: translateX(100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 60px 16px 24px;
    }

    .team-browser.content-visible .team-browser__content {
        transform: translateX(0);
    }

    .team-browser.content-visible .team-browser__back {
        display: flex;
    }

    .team-browser__search-input {
        font-size: 16px; /* Prevents iOS zoom */
    }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .team-browser__content {
        transition: none;
    }

    .team-browser__content-inner {
        animation: none;
    }

    .team-browser__skeleton-logo,
    .team-browser__skeleton-line,
    .team-browser__skeleton-card {
        animation: none;
        opacity: 0.5;
    }

    @keyframes tb-fadeIn {
        from { opacity: 1; transform: none; }
        to   { opacity: 1; transform: none; }
    }
}
