/* =============================================
   NBA 篮球视界 - 主样式表
   ============================================= */

/* === CSS Variables === */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a1f35;
    --bg-card-hover: #222a45;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-red: #ef4444;
    --accent-gold: #fbbf24;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-orange: #f97316;
    --border-color: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounceIn { 0% { transform: scale(0.3); opacity: 0; } 50% { transform: scale(1.05); } 70% { transform: scale(0.95); } 100% { transform: scale(1); opacity: 1; } }

/* === Header === */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #0c1428 0%, #1a1040 50%, #0c1428 100%);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.header-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(239,68,68,0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(59,130,246,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.header-inner {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
    animation: float 3s ease-in-out infinite;
    line-height: 1;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #ef4444, #fbbf24);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 4px;
    text-transform: uppercase;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.live-indicator {
    font-size: 0.75rem;
    color: var(--accent-green);
    display: none;
}
.live-indicator.active { display: inline; animation: pulse 2s infinite; }

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

/* === Tab Nav === */
.tab-nav {
    position: relative;
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    gap: 2px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    position: relative;
    font-family: inherit;
}

.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.03); }
.tab-btn.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
    background: linear-gradient(to top, rgba(251,191,36,0.05), transparent);
}

.tab-icon { font-size: 1.1rem; }

/* === Main === */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
    min-height: calc(100vh - 200px);
}

.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.section-icon { font-size: 1.2rem; }

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    flex: 1;
}

.section-badge {
    font-size: 0.7rem;
    color: var(--accent-blue);
    background: rgba(59,130,246,0.1);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(59,130,246,0.2);
}

/* === News Section === */
.news-section {
    margin-bottom: 24px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(26,31,53,0.8), rgba(17,24,39,0.8));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.news-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 0 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.news-scroll::-webkit-scrollbar { height: 3px; }

.news-card {
    min-width: 260px;
    max-width: 320px;
    flex-shrink: 0;
    scroll-snap-align: start;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.news-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.news-card-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
}

.news-card-body {
    padding: 12px 14px;
}

.news-card-title {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.news-card-source {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.news-card-time {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* === Date Nav === */
.date-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.date-btn {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    font-family: inherit;
    line-height: 1;
}

.date-btn:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.today-btn {
    background: var(--accent-red) !important;
    border-color: var(--accent-red) !important;
    color: white !important;
    font-weight: 700;
    font-size: 0.75rem;
}
.today-btn:hover { opacity: 0.9; }

.date-display {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 130px;
    text-align: center;
    color: var(--text-primary);
}

/* === Loading States === */
.loading-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.loading-state p { margin-top: 14px; }
.loading-state-sm { padding: 20px; text-align: center; }

.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
.spinner.lg { width: 48px; height: 48px; border-width: 4px; }
.spinner-sm { width: 24px; height: 24px; border: 2px solid var(--border-color); border-top-color: var(--accent-red); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto; }

.error-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.error-state .error-icon { font-size: 3rem; margin-bottom: 12px; }
.error-state p { margin-bottom: 14px; }

.retry-btn {
    padding: 10px 24px;
    background: var(--accent-red);
    border: none;
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    font-family: inherit;
}
.retry-btn:hover { opacity: 0.9; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* === Game Cards === */
.games-container { display: grid; gap: 12px; }

.game-card {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 18px 22px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.02), transparent);
    pointer-events: none;
}

.game-card:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.game-card.live { border-color: var(--accent-red); box-shadow: 0 0 30px rgba(239,68,68,0.08); }
.game-card.live::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-red);
    animation: pulse 1.5s infinite;
}

.game-team {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.game-team.visitor { justify-content: flex-end; text-align: right; }

.game-team-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 50%;
    transition: var(--transition);
}

.game-card:hover .game-team-logo { transform: scale(1.1); }

.game-team-info { min-width: 0; }

.game-team-name {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-team-record {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.game-score-section {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
}

.game-score {
    font-size: 1.8rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    min-width: 40px;
    text-align: center;
    letter-spacing: -1px;
}

.game-score.winner { color: var(--accent-gold); text-shadow: 0 0 20px rgba(251,191,36,0.3); }

.game-score-divider {
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: 300;
}

.game-status {
    text-align: center;
    min-width: 80px;
}

.game-status-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
}

.game-status-badge.final { background: rgba(100,116,139,0.15); color: var(--text-muted); }
.game-status-badge.live { background: rgba(239,68,68,0.15); color: var(--accent-red); animation: pulse 1.5s infinite; }
.game-status-badge.scheduled { background: rgba(59,130,246,0.1); color: var(--accent-blue); }

.game-status-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === Leaderboard === */
.leaderboard-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.lb-tab {
    padding: 8px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
    font-family: inherit;
}

.lb-tab:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.lb-tab.active {
    background: linear-gradient(135deg, rgba(239,68,68,0.2), rgba(251,191,36,0.2));
    border-color: var(--accent-red);
    color: var(--accent-gold);
}

.leaderboard-container {}

.leaderboard-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: var(--transition);
}

.leaderboard-card:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.leaderboard-card.top-1 { border-color: rgba(251,191,36,0.3); background: linear-gradient(135deg, rgba(251,191,36,0.05), transparent); }
.leaderboard-card.top-2 { border-color: rgba(148,163,184,0.2); }
.leaderboard-card.top-3 { border-color: rgba(251,146,60,0.2); }

.lb-rank {
    width: 32px;
    text-align: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.lb-rank.gold { color: var(--accent-gold); }
.lb-rank.silver { color: #94a3b8; }
.lb-rank.bronze { color: #f97316; }

.lb-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card-hover));
    flex-shrink: 0;
    overflow: hidden;
}

.lb-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lb-info { flex: 1; min-width: 0; }
.lb-name { font-weight: 700; font-size: 0.9rem; }
.lb-team { font-size: 0.72rem; color: var(--text-muted); }

.lb-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-align: right;
}

.lb-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: right;
}

/* === Standings === */
.standings-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.conf-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.conf-header {
    padding: 16px 20px;
    font-size: 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.conf-header.east { color: var(--accent-red); }
.conf-header.west { color: var(--accent-blue); }

.standings-table {
    width: 100%;
    border-collapse: collapse;
}

.standings-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0,0,0,0.15);
}

.standings-table td {
    padding: 10px 14px;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.standings-table tr:hover td { background: rgba(255,255,255,0.02); }

.standings-table .rank-cell {
    font-weight: 700;
    color: var(--text-muted);
    width: 30px;
    font-size: 0.75rem;
}

.standings-table .team-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.standings-table .team-logo-sm {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.standings-table .team-name { font-weight: 600; }

.standings-table .pct-cell {
    font-weight: 700;
    color: var(--text-secondary);
}

.standings-table .streak-cell.win { color: var(--accent-green); }
.standings-table .streak-cell.loss { color: var(--accent-red); }

/* === Playoff indicator === */
.playoff-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.playoff-indicator.confirmed { background: var(--accent-green); }
.playoff-indicator.eliminated { background: var(--text-muted); }

/* === Loading Overlay === */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(11,15,26,0.85);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
}
.loading-overlay.hidden { display: none; }
.loading-overlay p { margin-top: 16px; color: var(--text-secondary); }

/* === Footer === */
footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    margin-top: 40px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    text-align: center;
}

.footer-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.footer-nba-logo { font-size: 1.5rem; }
.footer-brand {
    font-size: 0.9rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fbbf24, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.footer-ver { font-size: 0.65rem; color: var(--text-muted); margin-top: 6px; }

/* === Responsive === */
@media (max-width: 768px) {
    .header-inner { padding: 12px 16px; }
    .logo-text h1 { font-size: 1.15rem; }
    .logo-sub { display: none; }
    .header-info { flex-direction: column-reverse; gap: 4px; align-items: flex-end; }
    .header-date { font-size: 0.72rem; }

    .tab-nav { padding: 0 12px; overflow-x: auto; }
    .tab-btn { padding: 12px 14px; font-size: 0.78rem; white-space: nowrap; }

    main { padding: 14px 12px; }

    .game-card { flex-wrap: wrap; padding: 14px 16px; gap: 8px; }
    .game-team-logo { width: 34px; height: 34px; }
    .game-score-section { padding: 0 12px; gap: 10px; }
    .game-score { font-size: 1.4rem; min-width: 30px; }
    .game-team-name { font-size: 0.82rem; }

    .standings-container { grid-template-columns: 1fr; }

    .news-card { min-width: 200px; max-width: 260px; }
    .news-card-img { height: 100px; }
    .news-card-title { font-size: 0.75rem; }

    .leaderboard-card { padding: 12px 14px; }
    .lb-value { font-size: 1.1rem; }

    .section-header h2 { font-size: 1rem; }
    .date-display { font-size: 0.75rem; min-width: 100px; }
    .date-btn { padding: 5px 10px; font-size: 0.72rem; }
}

@media (max-width: 480px) {
    .game-team-info { display: none; }
    .game-status { min-width: 60px; }
    .game-score-section { padding: 0 8px; gap: 6px; }
    .game-score { font-size: 1.1rem; min-width: 24px; }
    .lb-rank { width: 24px; font-size: 0.8rem; }
    .standings-table th, .standings-table td { padding: 8px 8px; font-size: 0.68rem; }
}
