/* =============================================================
 * sports-hub.css  —  스포츠 허브 카테고리 모듈
 *
 * 의존: _tokens.css (색상/폰트/간격/반경/그림자/브레이크포인트 변수)
 * 규약: 브레이크포인트 표준 (≤ 480 / 768 / 1024 / 1280 / 1400 / 1920)
 *       색상/폰트값은 var(--*) 참조 사용
 * ============================================================= */

/* hidden 속성 브라우저 호환 */
[hidden] { display: none !important; }

/* JS 초기화 전 플래시 방지: 필터 적용 완료 전까지 패널 숨김 */
.sports-hub[data-loading] .sports-hub__panel {
    visibility: hidden;
}

/* 라이브 점 애니메이션 */
@keyframes sh-pulse {
    0%, 100% { opacity: 1;   transform: scale(1);   }
    50%       { opacity: 0.4; transform: scale(0.75); }
}

/* =============================================================================
   Root
   ============================================================================= */
.sports-hub {
    --sh-primary:   #ff3a3a;
    --sh-live:      #e53e3e;
    --sh-scheduled: #3182ce;
    --sh-finished:  #718096;
    --sh-border:    #e8e8e8;
    --sh-bg:        var(--color-white);
    --sh-bg-alt:    #f7f7f7;
    --sh-text:      #1a1a1a;
    --sh-text-mute: var(--color-gray-666);
    --sh-radius:    8px;
    --sh-shadow:    0 1px 4px rgba(var(--rgb-black), .08);

    background: var(--sh-bg);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    margin-bottom: 28px;
    overflow: hidden;
    font-family: 'Noto Sans KR', sans-serif;
}

/* =============================================================================
   헤더
   ============================================================================= */
.sports-hub__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 2px solid var(--sh-primary);
    gap: 8px;
}

.sports-hub__heading {
    margin: 0;
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--sh-text);
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}

.sports-hub__heading-icon {
    font-size: var(--fs-2xl);
    line-height: 1;
}

.sports-hub__today {
    font-size: var(--fs-sm);
    color: var(--sh-text-mute);
    white-space: nowrap;
}

/* =============================================================================
   테스트 안내 배너
   ============================================================================= */
.sports-hub__notice {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    font-size: var(--fs-sm);
    color: #92400e;
    line-height: 1.5;
}

.sports-hub__notice-icon {
    flex-shrink: 0;
    font-size: var(--fs-md);
    line-height: 1;
}

/* =============================================================================
   데이터 갱신 중 알림
   ============================================================================= */
.sports-hub__refresh-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #ebf8ff;
    border-bottom: 1px solid #bee3f8;
    font-size: var(--fs-sm);
    color: #2b6cb0;
}

.sports-hub__refresh-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #bee3f8;
    border-top-color: #2b6cb0;
    border-radius: 50%;
    animation: sh-spin .8s linear infinite;
    flex-shrink: 0;
}

@keyframes sh-spin {
    to { transform: rotate(360deg); }
}

/* =============================================================================
   종목 탭 내비게이션
   ============================================================================= */
.sports-hub__sport-nav {
    border-bottom: 1px solid var(--sh-border);
    background: var(--sh-bg);
}

.sports-hub__sport-tabs {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 0;
}
.sports-hub__sport-tabs::-webkit-scrollbar { display: none; }

.sports-hub__sport-tab {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 18px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    color: var(--sh-text-mute);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.sports-hub__sport-tab:hover {
    color: var(--sh-primary);
}

.sports-hub__sport-tab.is-active {
    color: var(--sh-primary);
    border-bottom-color: var(--sh-primary);
    font-weight: var(--fw-bold);
}

.sport-tab__icon {
    font-size: var(--fs-2xl);
    line-height: 1;
}

.sport-tab__label {
    font-size: var(--fs-sm);
    line-height: 1;
}

.sport-tab__badge {
    display: none;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    background: var(--sh-primary);
    color: var(--color-white);
    border-radius: 10px;
    padding: 0 5px;
    min-width: 16px;
    line-height: 16px;
    text-align: center;
}
.sport-tab__badge:not(:empty) { display: inline-block; }
.sports-hub__sport-tab.is-active .sport-tab__badge {
    background: var(--color-white);
    color: var(--sh-primary);
}

/* =============================================================================
   필터 (날짜 + 상태)
   ============================================================================= */
.sports-hub__filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: var(--sh-bg-alt);
    border-bottom: 1px solid var(--sh-border);
}

/* 날짜 버튼 그룹 */
.sports-hub__date-group {
    display: flex;
    gap: 4px;
}

.sports-hub__date-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 12px;
    border: 1px solid var(--sh-border);
    border-radius: 20px;
    background: var(--sh-bg);
    font-family: inherit;
    font-size: var(--fs-sm);
    color: var(--sh-text-mute);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.2;
}
.sports-hub__date-btn:hover,
.sports-hub__date-btn.is-active {
    background: var(--sh-primary);
    color: var(--color-white);
    border-color: var(--sh-primary);
}

.date-btn__label {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
}

.date-btn__dow {
    font-size: var(--fs-xs);
    opacity: .8;
}

/* 상태 버튼 그룹 */
.sports-hub__status-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.sports-hub__status-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--sh-border);
    border-radius: 20px;
    background: var(--sh-bg);
    font-family: inherit;
    font-size: var(--fs-xs);
    color: var(--sh-text-mute);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.sports-hub__status-btn:hover,
.sports-hub__status-btn.is-active {
    background: var(--sh-text);
    color: var(--color-white);
    border-color: var(--sh-text);
}
.sports-hub__status-btn.is-live.is-active {
    background: var(--sh-live);
    border-color: var(--sh-live);
}

/* =============================================================================
   경기 목록
   ============================================================================= */
.sports-hub__panel {
    padding: 12px;
}

/* 리그 그룹 목록 — 세로 스택 */
.sports-hub__match-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 리그 그룹 헤더 */
.sports-hub__group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    padding: 0 0 6px;
    border-bottom: 1px solid var(--sh-border);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    color: var(--sh-text-mute);
    text-transform: uppercase;
    letter-spacing: .4px;
    line-height: 1;
}

.group-header__name {
    color: var(--sh-text);
}

.group-header__season {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    background: var(--sh-bg-alt);
    border: 1px solid var(--sh-border);
    border-radius: 3px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--sh-text-mute);
    letter-spacing: .2px;
}

/* 카드 그리드 — 모바일 1열 */
.sports-hub__group-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

/* 빈 결과 */
.sports-hub__empty {
    text-align: center;
    padding: 24px 0;
    color: var(--sh-text-mute);
    font-size: var(--fs-base);
}

/* =============================================================================
   경기 카드
   ============================================================================= */
.sports-hub__match-card {
    background: var(--sh-bg);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    padding: 10px 12px;
    box-shadow: var(--sh-shadow);
    transition: box-shadow .2s;
}
.sports-hub__match-card:hover {
    box-shadow: 0 3px 10px rgba(var(--rgb-black), .12);
}

/* 진행중 카드 강조 — 4면 테두리 */
.sports-hub__match-card--live {
    border: 2px solid var(--sh-live);
}

/* 카드 상단: 대회명 + 상태 뱃지 */
.match-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

/* 라운드 표시 (그룹 헤더 이동 후 카드에는 라운드만 남음) */
.match-card__round {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--sh-text-mute);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 상태 뱃지 */
.match-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    white-space: nowrap;
    flex-shrink: 0;
}
.match-card__badge--live      { background: #fff5f5; color: var(--sh-live);      border: 1px solid #fed7d7; }
.match-card__badge--scheduled { background: #ebf8ff; color: var(--sh-scheduled); border: 1px solid #bee3f8; }
.match-card__badge--finished  { background: #f7fafc; color: var(--sh-finished);  border: 1px solid #e2e8f0; }
.match-card__badge--postponed { background: #fffaf0; color: #c05621;             border: 1px solid #fbd38d; }
.match-card__badge--cancelled { background: #fff5f5; color: #c53030;             border: 1px solid #feb2b2; }
.match-card__badge--suspended { background: #faf5ff; color: #6b46c1;             border: 1px solid #d6bcfa; }

/* 카드 본문: 홈팀 | 스코어 | 원정팀 */
.match-card__body {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.match-card__team {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    min-width: 0;  /* flex 자식 말줄임 허용 */
}

.match-card__team--home {
    justify-content: flex-start;
    text-align: left;
}

.match-card__team--away {
    justify-content: flex-end;
    text-align: right;
    flex-direction: row-reverse;  /* 로고가 오른쪽 끝에 오도록 */
}

/* 팀 로고 */
.team-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 2px;
}

.team-name {
    font-size: var(--fs-base);
    font-weight: var(--fw-bold);
    color: var(--sh-text);
    line-height: 1.3;
    word-break: keep-all;
}

/* 팀명 이중 출력: 모바일(기본) = short, 데스크탑 = full */
.team-name__full  { display: none; }
.team-name__short { display: inline; }

/* 승리팀 강조 */
.match-card__team.is-winner .team-name {
    color: var(--sh-primary);
}

/* 중앙 (스코어 / 시간) */
.match-card__center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
}

/* 예정 시간 */
.match-card__time {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--sh-scheduled);
    letter-spacing: .5px;
}

/* 스코어 */
.match-card__score {
    display: flex;
    align-items: center;
    gap: 4px;
}

.score-num {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-black);
    color: var(--sh-text);
    min-width: 22px;
    text-align: center;
    line-height: 1;
}

.score-num.is-win {
    color: var(--sh-primary);
}

.score-sep {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--sh-text-mute);
    line-height: 1;
}

/* 라이브 스코어 깜빡임 */
.match-card__score.is-live .score-num {
    animation: sh-pulse 2s ease-in-out infinite;
}

/* 카드 메타 (경기장) */
.match-card__meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.match-card__venue {
    font-size: var(--fs-xs);
    color: var(--sh-text-mute);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 라이브 점 */
.live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sh-live);
    animation: sh-pulse 1.4s ease-in-out infinite;
    vertical-align: middle;
    flex-shrink: 0;
}

/* =============================================================================
   반응형 — 태블릿 이상 (600px+): 팀명 full 표시
   ============================================================================= */
@media (min-width: 768px) {
    .team-name__full  { display: inline; }
    .team-name__short { display: none; }
}

/* =============================================================================
   반응형 — 태블릿 이상 (768px+)
   ============================================================================= */
@media (min-width: 768px) {
    /* match-list는 flex-column 유지, 카드 그리드만 2열로 확장 */
    .sports-hub__group-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .sports-hub__sport-tab {
        flex-direction: row;
        gap: 6px;
        padding: 10px 22px;
        font-size: var(--fs-base);
    }

    .sport-tab__label {
        font-size: var(--fs-base);
    }

    .team-name {
        font-size: var(--fs-md);
    }

    .score-num {
        font-size: var(--fs-4xl);
        min-width: 26px;
    }
}

/* =============================================================================
   반응형 — 데스크탑 (1024px+): 2열 유지 (3열 → 2열 변경)
   ============================================================================= */
@media (min-width: 1024px) {
    .sports-hub__group-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .sports-hub__header {
        padding: 16px 20px 14px;
    }

    .sports-hub__heading {
        font-size: var(--fs-2xl);
    }

    .sports-hub__filters {
        padding: 10px 16px;
    }

    .sports-hub__panel {
        padding: 16px;
    }
}

/* =============================================================================
   주요 경기 (is-featured)
   ============================================================================= */
.sports-hub__match-card.is-featured {
    border-color: var(--sh-primary);
    border-width: 2px;
    position: relative;
}

.sports-hub__match-card.is-featured::before {
    content: '주요';
    position: absolute;
    top: -1px;
    right: 10px;
    background: var(--sh-primary);
    color: var(--color-white);
    font-size: 9px;
    font-weight: var(--fw-bold);
    padding: 1px 6px;
    border-radius: 0 0 4px 4px;
    letter-spacing: .3px;
}

/* =============================================================================
   관련 기사 링크
   ============================================================================= */
.match-card__related {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--sh-border);
    text-align: right;
}

.match-card__related-link {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--sh-primary);
    text-decoration: none;
    transition: opacity .15s;
}

.match-card__related-link:hover {
    opacity: .75;
    text-decoration: underline;
}

/* =============================================================================
   경기 아이템 래퍼 (아코디언)
   ============================================================================= */
.sports-hub__match-item {
    display: flex;
    flex-direction: column;
}

/* 상세 정보 토글 버튼 */
.sports-hub__detail-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    padding: 5px 12px;
    border: 1px solid var(--sh-border);
    border-top: none;
    border-radius: 0 0 var(--sh-radius) var(--sh-radius);
    background: var(--sh-bg-alt);
    font-family: inherit;
    font-size: var(--fs-xs);
    color: var(--sh-text-mute);
    cursor: pointer;
    transition: background .15s, color .15s;
    -webkit-tap-highlight-color: transparent;
}

.sports-hub__detail-toggle:hover {
    background: #efefef;
    color: var(--sh-text);
}

/* 토글 열림 상태 */
.sports-hub__match-item.is-open .sports-hub__detail-toggle {
    background: #efefef;
    color: var(--sh-text);
    border-radius: 0;
}

/* 아래 화살표 아이콘 (CSS-only chevron) */
.detail-toggle__chevron {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .2s;
    flex-shrink: 0;
}
.sports-hub__match-item.is-open .detail-toggle__chevron {
    transform: rotate(-135deg) translateY(-2px);
}

/* 상세 패널 */
.sports-hub__match-detail {
    border: 1px solid var(--sh-border);
    border-top: none;
    border-radius: 0 0 var(--sh-radius) var(--sh-radius);
    background: var(--sh-bg);
    overflow: hidden;
}

/* 카드와 토글 버튼이 연결되도록 카드 하단 radius 제거 */
.sports-hub__match-item .sports-hub__match-card {
    border-radius: var(--sh-radius) var(--sh-radius) 0 0;
    border-bottom: none;
}

/* 상세 탭 */
.match-detail__tabs {
    display: flex;
    border-bottom: 1px solid var(--sh-border);
    background: var(--sh-bg-alt);
}

.match-detail__tab-btn {
    flex: 1;
    padding: 7px 12px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--sh-text-mute);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
    -webkit-tap-highlight-color: transparent;
}

.match-detail__tab-btn:hover {
    color: var(--sh-text);
}

.match-detail__tab-btn.is-active {
    color: var(--sh-primary);
    border-bottom-color: var(--sh-primary);
    background: var(--sh-bg);
}

/* 탭 패널 */
.match-detail__panel {
    padding: 12px;
}

/* 로딩 / 빈 상태 */
.match-detail__loading,
.match-detail__empty {
    text-align: center;
    padding: 16px;
    font-size: var(--fs-sm);
    color: var(--sh-text-mute);
}

/* =============================================================================
   전적 (H2H) 목록
   ============================================================================= */
.sh-h2h__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sh-h2h__row {
    display: grid;
    grid-template-columns: 56px 1fr auto 1fr;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--sh-bg-alt);
    border-radius: 4px;
    font-size: var(--fs-xs);
}

.sh-h2h__date {
    color: var(--sh-text-mute);
    font-size: var(--fs-xs);
    white-space: nowrap;
}

.sh-h2h__team {
    font-weight: var(--fw-semibold);
    color: var(--sh-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sh-h2h__team--away {
    text-align: right;
}

.sh-h2h__team--win {
    color: var(--sh-primary);
}

.sh-h2h__score {
    text-align: center;
    font-weight: var(--fw-black);
    font-size: var(--fs-base);
    color: var(--sh-text);
    white-space: nowrap;
    min-width: 36px;
}

/* =============================================================================
   엔트리 (Squad) 목록
   ============================================================================= */
.sh-squad__group {
    margin-bottom: 12px;
}

.sh-squad__pos-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sh-text-mute);
    padding: 0 0 4px;
    border-bottom: 1px solid var(--sh-border);
    margin-bottom: 6px;
}

.sh-squad__players {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 4px;
}

.sh-squad__player {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    background: var(--sh-bg-alt);
    border-radius: 4px;
    font-size: var(--fs-xs);
}

.sh-squad__num {
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    color: var(--sh-text-mute);
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sh-squad__name {
    font-weight: var(--fw-semibold);
    color: var(--sh-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
