/**
 * Senka (戦果) — Sistema de Torneos y Liga Beyblade X (BDB)
 * Hojas de Estilo para Leaderboard de Temporada, Podios y Perfil de Blader (Sesión 5)
 * Autor: Sebastián Ariza / https://sebastiandeveloper.website/
 */

/* =====================================================================
   1. Leaderboard & Temporada Header Bar
   ===================================================================== */
.league-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-bottom: 2rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.league-header-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.league-header-title .trophy-icon {
    color: var(--gold-trophy);
    filter: drop-shadow(0 0 8px var(--gold-glow));
}

.league-controls-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.league-search-input {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    min-width: 220px;
    transition: var(--transition-fast);
}

.league-search-input:focus {
    outline: none;
    border-color: var(--cyan-neon);
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2);
}

.league-season-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    cursor: pointer;
}

/* =====================================================================
   2. Podio Olímpico de Temporada (Top 3)
   ===================================================================== */
.season-podium-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    align-items: flex-end;
    margin: 2rem 0 3rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .season-podium-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.podium-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1rem 1.2rem;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.podium-card:hover {
    transform: translateY(-6px);
}

.podium-card.rank-1 {
    order: 2;
    border-color: var(--gold-trophy);
    box-shadow: 0 8px 24px var(--gold-glow);
    background: linear-gradient(180deg, rgba(255, 183, 0, 0.12) 0%, var(--bg-surface) 60%);
    padding-top: 2rem;
}

.podium-card.rank-2 {
    order: 1;
    border-color: rgba(224, 224, 224, 0.5);
    box-shadow: 0 6px 18px rgba(224, 224, 224, 0.15);
    background: linear-gradient(180deg, rgba(224, 224, 224, 0.08) 0%, var(--bg-surface) 60%);
}

.podium-card.rank-3 {
    order: 3;
    border-color: rgba(205, 127, 50, 0.5);
    box-shadow: 0 6px 18px rgba(205, 127, 50, 0.15);
    background: linear-gradient(180deg, rgba(205, 127, 50, 0.08) 0%, var(--bg-surface) 60%);
}

@media (max-width: 768px) {
    .podium-card.rank-1 { order: 1; }
    .podium-card.rank-2 { order: 2; }
    .podium-card.rank-3 { order: 3; }
}

.podium-avatar-wrapper {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    margin: 0 auto 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    position: relative;
    overflow: visible !important;
}

.podium-card.rank-1 .podium-avatar-wrapper {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #ffd700, #ff8800);
    color: #1a1000;
    box-shadow: 0 0 16px rgba(255, 183, 0, 0.5);
}

.podium-card.rank-2 .podium-avatar-wrapper {
    background: linear-gradient(135deg, #e6e6e6, #8a9ba8);
    color: #0b151e;
    box-shadow: 0 0 12px rgba(224, 224, 224, 0.35);
}

.podium-card.rank-3 .podium-avatar-wrapper {
    background: linear-gradient(135deg, #cd7f32, #7a4618);
    color: #fff;
    box-shadow: 0 0 12px rgba(205, 127, 50, 0.35);
}

.podium-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 1;
}

.podium-card.rank-1 .podium-avatar-img {
    border: 3px solid #ffd700;
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.6);
}

.podium-card.rank-2 .podium-avatar-img {
    border: 3px solid #e6e6e6;
    box-shadow: 0 0 12px rgba(230, 230, 230, 0.45);
}

.podium-card.rank-3 .podium-avatar-img {
    border: 3px solid #cd7f32;
    box-shadow: 0 0 12px rgba(205, 127, 50, 0.45);
}

.podium-rank-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
    padding: 0.22rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--bg-deep);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    z-index: 10;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.podium-card.rank-1 .podium-rank-badge {
    background: #ffd700;
    color: #1a1000;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.7);
}

.podium-card.rank-2 .podium-rank-badge {
    background: #e6e6e6;
    color: #0b151e;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(230, 230, 230, 0.5);
}

.podium-card.rank-3 .podium-rank-badge {
    background: #cd7f32;
    color: #ffffff;
    border: 2px solid #ffd7a0;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.5);
}

.podium-blader-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.15rem;
    color: var(--text-primary);
}

.podium-blader-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    font-weight: 500;
}

.podium-points {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--cyan-neon);
    margin-bottom: 0;
}

/* =====================================================================
   3. Tabla de Posiciones Acumulativa (Leaderboard Table)
   ===================================================================== */
.leaderboard-table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.leaderboard-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.leaderboard-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
    white-space: nowrap;
}

.leaderboard-table th {
    background: rgba(8, 21, 32, 0.85);
    padding: 0.9rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(0, 229, 255, 0.05);
    color: var(--text-secondary);
    vertical-align: middle;
}

.leaderboard-table tr:hover td {
    background: rgba(0, 229, 255, 0.04);
}

.leaderboard-table tr.clickable-row {
    cursor: pointer;
}

.rank-cell {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-align: center;
    width: 50px;
}

.rank-cell.rank-gold { color: #ffd700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
.rank-cell.rank-silver { color: #e0e0e0; text-shadow: 0 0 6px rgba(224, 224, 224, 0.3); }
.rank-cell.rank-bronze { color: #cd7f32; text-shadow: 0 0 6px rgba(205, 127, 50, 0.3); }

.blader-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.blader-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-surface-elevated), var(--border-medium));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--cyan-neon);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.blader-cell-name {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.blader-cell-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.league-points-badge {
    font-weight: 800;
    font-size: 1rem;
    color: var(--cyan-neon);
    background: rgba(0, 229, 255, 0.08);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 229, 255, 0.2);
    display: inline-block;
}

/* Trofeos mini */
.trophies-badge-list {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.trophy-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
}

.trophy-chip.gold { background: rgba(255, 215, 0, 0.15); color: #ffd700; }
.trophy-chip.silver { background: rgba(224, 224, 224, 0.15); color: #e0e0e0; }
.trophy-chip.bronze { background: rgba(205, 127, 50, 0.15); color: #cd7f32; }

/* Chips de Acabados Beyblade X */
.finishes-pills-row {
    display: inline-flex;
    gap: 0.35rem;
    font-size: 0.75rem;
}

.finish-pill {
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
}

.finish-pill.spin { background: rgba(0, 229, 255, 0.12); color: var(--cyan-neon); }
.finish-pill.over { background: rgba(0, 230, 118, 0.12); color: var(--success); }
.finish-pill.burst { background: rgba(255, 171, 0, 0.12); color: var(--warning); }
.finish-pill.xtreme { background: rgba(255, 85, 0, 0.18); color: var(--orange-xtreme); border: 1px solid rgba(255, 85, 0, 0.3); }

/* =====================================================================
   4. Perfil de Blader & Dashboards con Chart.js (Sesión 5 Entregable 3)
   ===================================================================== */
.blader-profile-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 3rem;
}

.blader-hero-card {
    background: linear-gradient(135deg, var(--bg-surface-elevated) 0%, var(--bg-surface) 100%);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.blader-hero-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: radial-gradient(circle at 100% 50%, rgba(0, 229, 255, 0.08), transparent 70%);
    pointer-events: none;
}

.blader-hero-main {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.blader-hero-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan-neon), #0077b6);
    color: #03080e;
    font-size: 2.4rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px var(--cyan-neon-glow);
    border: 3px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.blader-hero-info h2 {
    font-family: var(--font-heading);
    font-size: 1.9rem;
    font-weight: 800;
    margin: 0 0 0.3rem;
    color: var(--text-primary);
}

.blader-badges-list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.blader-rank-pill {
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid var(--border-strong);
    color: var(--cyan-neon);
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0.25rem 0.7rem;
    border-radius: var(--radius-full);
}

.blader-hero-kpis {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.hero-kpi-item {
    background: rgba(8, 21, 32, 0.6);
    border: 1px solid var(--border-subtle);
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-md);
    text-align: center;
    min-width: 100px;
}

.hero-kpi-val {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--cyan-neon);
    line-height: 1.1;
}

.hero-kpi-lbl {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 0.2rem;
}

/* Grid de Tarjetas de Gráficas Chart.js */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (max-width: 992px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.8rem;
}

.chart-card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-canvas-container {
    position: relative;
    width: 100%;
    height: 280px;
}

/* Listados secundarios de torneos y partidos */
.history-tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .history-tables-grid {
        grid-template-columns: 1fr;
    }
}

.match-history-chip {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.match-history-chip.victory {
    background: rgba(0, 230, 118, 0.18);
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

.match-history-chip.defeat {
    background: rgba(255, 23, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 23, 68, 0.3);
}
