/* Daum体育排行页面样式
 * 参考naver-rank.css结构，新增MLB子联盟切换栏
 */

/* iframe内容body */
.daum-sport-iframe-body {
    background: #FFFFFF;
    margin: 0;
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Malgun Gothic', sans-serif;
    color: #212121;
}

.daum-sport-main {
    background: #F5F7FA;
    padding: 20px;
    min-height: 600px;
}

/* 服务不可用提示 */
.daum-sport-unavailable {
    text-align: center;
    padding: 80px 20px;
    color: #212121;
}

.daum-sport-unavailable .unavailable-icon {
    font-size: 48px;
    color: #FF9800;
    margin-bottom: 16px;
}

.daum-sport-unavailable p {
    margin: 8px 0;
    font-size: 16px;
}

.daum-sport-unavailable .unavailable-desc {
    color: #9E9E9E;
    font-size: 14px;
}

/* 运动分类选项组 */
.sport-type-grid {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid #E0E0E0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
    background: #FAFAFA;
}

.sport-type-card {
    flex: 1;
    min-width: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    background: transparent;
    color: #616161;
    border: none;
    border-right: 1px solid #E0E0E0;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sport-type-card:last-child {
    border-right: none;
}

.sport-type-card:hover {
    background: #E3F2FD;
    color: #1976D2;
}

.sport-type-card.active {
    background: #1976D2;
    color: #FFFFFF;
    font-weight: 600;
}

/* 联赛标签组 - 横向滑动 */
.league-tabs-scroll {
    display: flex;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 12px;
    gap: 4px;
}

.league-scroll-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 1px solid #E0E0E0;
    border-radius: 50%;
    background: #FFFFFF;
    color: #9E9E9E;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.league-scroll-btn:hover {
    background: #E3F2FD;
    border-color: #1976D2;
    color: #1976D2;
}

.league-scroll-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.league-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.league-tabs::-webkit-scrollbar {
    display: none;
}

.league-tab {
    display: inline-block;
    padding: 6px 14px;
    background: #FFFFFF;
    color: #616161;
    border: 1px solid #E0E0E0;
    border-radius: 16px;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.league-tab:hover {
    background: #E3F2FD;
    border-color: #1976D2;
    color: #1976D2;
}

.league-tab.active {
    background: #1976D2;
    border-color: #1976D2;
    color: #FFFFFF;
    font-weight: 600;
}

/* MLB子联盟切换栏 */
.sub-league-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px 0 12px;
    margin-bottom: 4px;
}

.sub-league-tab {
    padding: 5px 16px;
    background: #FFFFFF;
    color: #616161;
    border: 1px solid #E0E0E0;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sub-league-tab:hover {
    background: #E3F2FD;
    border-color: #1976D2;
    color: #1976D2;
}

.sub-league-tab.active {
    background: #1976D2;
    border-color: #1976D2;
    color: #FFFFFF;
    font-weight: 600;
}

/* 赛季选择器 */
.season-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 18px 0;
    border-bottom: 1px solid #E0E0E0;
    margin-bottom: 16px;
    position: relative;
}

.season-sub-league-bar {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 8px;
}

.season-nav-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid #E0E0E0;
    border-radius: 50%;
    background: #FFFFFF;
    color: #616161;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.season-nav-btn:hover:not(:disabled) {
    background: #E3F2FD;
    border-color: #1976D2;
    color: #1976D2;
}

.season-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.season-display {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 160px;
    justify-content: center;
}

.season-display .season-label {
    font-size: 15px;
    font-weight: 400;
    color: #9E9E9E;
}

.season-display #seasonCurrentName {
    font-size: 22px;
    font-weight: 700;
    color: #212121;
    letter-spacing: -0.5px;
}

/* 分区分组（ACL엘리트 동부/서부, ACL2 A~H조） */
.rank-division-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.rank-division-group {
    margin-bottom: 24px;
}

.rank-division-grid .rank-division-group {
    margin-bottom: 0;
}

.rank-division-group:last-child {
    margin-bottom: 0;
}

.rank-division-title {
    margin-bottom: 8px;
}

.rank-division-title h4 {
    font-size: 15px;
    font-weight: 700;
    color: #424242;
    margin: 0;
}

.rank-division-guide {
    margin-bottom: 8px;
}

/* KBO 순위 섹션 */
.kbo-section {
    margin-bottom: 28px;
}

.kbo-section:last-child {
    margin-bottom: 0;
}

.kbo-section-title {
    margin-bottom: 8px;
}

.kbo-section-title h4 {
    font-size: 15px;
    font-weight: 700;
    color: #424242;
    margin: 0;
}

.kbo-sortable:hover {
    background: #E3F2FD;
}

.kbo-sortable.active {
    background: #E3F2FD;
    color: #1976D2;
    font-weight: 600;
}

/* 퓨처스리그 분기 섹션 */
.futures-division-section {
    margin-bottom: 36px;
}

.futures-division-section:last-child {
    margin-bottom: 0;
}

.futures-division-title {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #E0E0E0;
}

.futures-division-title h3 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

/* MLB 종합 순위 2x2 grid */
.mlb-total-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.mlb-total-grid-item {
    min-width: 0;
}

.mlb-total-grid-item .rank-division-title {
    margin-bottom: 8px;
}

.mlb-total-grid-item .rank-division-title h4 {
    font-size: 14px;
    font-weight: 700;
    color: #424242;
    margin: 0;
}

/* MLB 공격/수비 1열 */
.mlb-stat-grid {
    display: block;
}

.mlb-stat-grid-item {
    min-width: 0;
    margin-bottom: 24px;
}

.mlb-stat-grid-item:last-child {
    margin-bottom: 0;
}

.mlb-stat-grid-item .rank-division-title {
    margin-bottom: 8px;
}

.mlb-stat-grid-item .rank-division-title h4 {
    font-size: 14px;
    font-weight: 700;
    color: #424242;
    margin: 0;
}

/* 排名图例 */
.rank-guide {
    margin-bottom: 10px;
}

.rank-guide-title {
    font-size: 13px;
    font-weight: 600;
    color: #424242;
    margin-bottom: 6px;
}

.rank-guide-report {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: #9E9E9E;
    text-decoration: none;
}

.rank-guide-report:hover {
    color: #1976D2;
    text-decoration: underline;
}

.rank-guide-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.rank-guide-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #616161;
    padding-left: 10px;
    border-left: 3px solid var(--point-color, #ccc);
}

/* 当前联赛/赛季信息 */
.current-info {
    padding: 8px 0;
    color: #424242;
    font-size: 14px;
    margin-bottom: 8px;
}

.current-info .info-separator {
    margin: 0 8px;
    color: #BDBDBD;
}

.current-info .info-league {
    font-weight: 600;
    color: #1976D2;
}

/* === 排行表格（ul/li结构） === */
.rank-table-wrap {
    background: #FFFFFF;
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ns-blind {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 表头 */
.rank-table-head {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    background: #FAFAFA;
    border-bottom: 2px solid #E0E0E0;
    border-left: 3px solid transparent;
    box-sizing: border-box;
    min-width: max-content;
}

.rank-table-body {
    list-style: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.rank-head-item {
    padding: 12px 8px;
    text-align: center;
    flex-shrink: 0;
    box-sizing: border-box;
}

.rank-head-text {
    color: #424242;
    font-weight: 600;
    font-size: 13px;
}

.rank-head-highlight {
    color: #1976D2;
}

/* 表体 */
.rank-body-item {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #F0F0F0;
    border-left: 3px solid var(--point-color, transparent);
    min-height: 55px;
    box-sizing: border-box;
    min-width: max-content;
}

.rank-body-item:nth-child(even) {
    background: #F9F9F9;
}

.rank-body-item:hover {
    background: #E3F2FD;
}

.rank-body-cell {
    padding: 10px 8px;
    text-align: center;
    flex-shrink: 0;
    font-size: 14px;
    color: #212121;
    box-sizing: border-box;
}

/* 첫 번째 열(flex:1) — 헤더/본문 동일 폭 보장 */
.rank-table-head > .rank-head-item:first-child,
.rank-body-item > .rank-body-cell:first-child {
    min-width: 150px;
}

/* 球队信息 */
.ns-team-info {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.ns-ranking {
    font-style: normal;
    font-weight: 700;
    font-size: 16px;
    color: #212121;
    min-width: 24px;
}

.ns-team-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ns-emblem {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ns-emblem img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.ns-team-name {
    color: #212121;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
}

/* 数据文本 */
.ns-text-info {
    display: inline-flex;
}

.ns-text {
    color: #212121;
    font-size: 14px;
}

.ns-highlight {
    font-weight: 700;
    color: #1976D2;
}

.ns-muted {
    color: #9E9E9E;
}

/* 최근 5경기 전적 */
.ns-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex-wrap: nowrap;
}

.ns-result-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    position: relative;
}

.ns-result-item svg {
    width: 20px;
    height: 20px;
}

.ns-result-item .ns-result-mark {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    background: #FFF;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* 无数据行 */
.no-data-row {
    text-align: center;
    padding: 40px 0;
    color: #9E9E9E;
    font-size: 14px;
}

/* 加载中 */
.rank-loading {
    text-align: center;
    padding: 60px 0;
    color: #9E9E9E;
    display: none;
}

#rankTableContainer {
    transition: opacity 0.25s ease;
}

.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
    border: 3px solid #E0E0E0;
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: daum-spin 0.8s linear infinite;
}

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

/* === 移动端卡片式布局 === */
.rank-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rank-card {
    background: #FFFFFF;
    border-radius: 8px;
    padding: 12px;
    border-left: 3px solid var(--point-color, transparent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.rank-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #F0F0F0;
    margin-bottom: 8px;
}

.rank-card-rank {
    font-weight: 700;
    font-size: 16px;
    color: #212121;
    min-width: 24px;
}

.rank-card-team {
    font-weight: 600;
    font-size: 14px;
    color: #212121;
}

.rank-card-fields {
    display: flex;
    flex-wrap: wrap;
}

.rank-card-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 50%;
    padding: 4px 8px;
    box-sizing: border-box;
}

.rank-card-field .field-label {
    color: #9E9E9E;
    font-size: 12px;
}

.rank-card-field .field-value {
    color: #212121;
    font-size: 13px;
    font-weight: 500;
}

.rank-card-field .field-highlight {
    color: #1976D2;
    font-weight: 700;
}

.rank-card-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
    padding-top: 8px;
    border-top: 1px solid #F0F0F0;
    margin-top: 8px;
}

.rank-card-form .ns-result-item {
    width: 18px;
    height: 18px;
}

.rank-card-form .ns-result-item svg {
    width: 18px;
    height: 18px;
}

.rank-card .ns-emblem img {
    width: 24px;
    height: 24px;
}

/* === 태블릿 대응 (769px~1024px) === */
@media (max-width: 1024px) {
    .rank-table-head,
    .rank-body-item {
        font-size: 12px;
    }

    .rank-head-item,
    .rank-body-cell {
        padding: 8px 6px;
    }

    .mlb-total-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .rank-division-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* === 모바일 대응 (≤768px) === */
@media (max-width: 768px) {
    .daum-sport-iframe-body {
        padding: 8px;
    }

    .daum-sport-main {
        padding: 10px;
    }

    /* 서비스 불가 안내 */
    .daum-sport-unavailable {
        padding: 40px 16px;
    }

    .daum-sport-unavailable .unavailable-icon {
        font-size: 36px;
    }

    /* 종목 카드 */
    .sport-type-grid {
        margin-bottom: 10px;
    }

    .sport-type-card {
        min-width: 70px;
        padding: 10px 4px;
        font-size: 12px;
    }

    /* 리그 탭 */
    .league-tabs-scroll {
        padding: 8px 0;
        margin-bottom: 8px;
    }

    .league-scroll-btn {
        width: 32px;
        height: 32px;
    }

    .league-tab {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* 서브리그 탭 (MLB NL/AL) */
    .sub-league-bar {
        padding: 6px 0 8px;
    }

    .sub-league-tab {
        padding: 6px 14px;
        font-size: 12px;
    }

    /* 시즌 선택기 */
    .season-bar {
        gap: 10px;
        padding: 12px 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    .season-sub-league-bar {
        position: static;
        transform: none;
        width: 100%;
        justify-content: center;
        padding-top: 6px;
    }

    .season-nav-btn {
        width: 36px;
        height: 36px;
    }

    .season-display {
        min-width: 100px;
    }

    .season-display #seasonCurrentName {
        font-size: 18px;
    }

    /* 현재 리그/시즌 정보 */
    .current-info {
        font-size: 13px;
        padding: 6px 0;
    }

    /* 순위 규칙 */
    .rank-guide-list {
        gap: 8px;
    }

    .rank-guide-item {
        font-size: 11px;
    }

    /* 표 헤더/본문 */
    .rank-table-head,
    .rank-body-item {
        font-size: 12px;
    }

    .rank-head-item,
    .rank-body-cell {
        padding: 8px 4px;
    }

    .rank-body-item {
        min-height: 44px;
    }

    /* 팀 정보 */
    .ns-ranking {
        font-size: 14px;
        min-width: 20px;
    }

    .ns-team-area {
        gap: 6px;
    }

    .ns-emblem img {
        width: 22px;
        height: 22px;
    }

    .ns-team-name {
        font-size: 13px;
    }

    /* KBO/KBL/NBA 섹션 */
    .kbo-section {
        margin-bottom: 20px;
    }

    .kbo-section-title h4,
    .rank-division-title h4 {
        font-size: 14px;
    }

    .rank-division-group {
        margin-bottom: 16px;
    }

    /* 모바일 카드 */
    .rank-card {
        padding: 10px;
    }

    .rank-card-rank {
        font-size: 15px;
    }

    .rank-card-team {
        font-size: 13px;
    }

    .rank-card-field {
        width: 50%;
        padding: 3px 6px;
    }

    .rank-card-field .field-label {
        font-size: 11px;
    }

    .rank-card-field .field-value {
        font-size: 12px;
    }

    .rank-card .ns-emblem img {
        width: 22px;
        height: 22px;
    }

    /* 디비전 그리드 */
    .rank-division-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* 로딩 */
    .rank-loading {
        padding: 40px 0;
    }

    .loading-spinner {
        width: 28px;
        height: 28px;
    }
}