/* ============================================================================
   DESIGN SYSTEM - Paquete B (paginas de competicion)
   Componentes para: ranking publico, bracket, poster, event_details
   Cargado DESPUES de design-system.css
   ============================================================================ */

/* ============================================================================
   1. RANKING PUBLICO - tabla con avatares
   ============================================================================ */

.rp-ranking-wrapper {
    background: white;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-lg);
    overflow: hidden;
    box-shadow: var(--rp-shadow-sm);
}

.rp-ranking-header {
    padding: 28px 32px;
    background: var(--rp-bg-2);
    border-bottom: 1px solid var(--rp-border);
}

.rp-ranking-header h1 {
    font-size: 1.75rem !important;
    margin-bottom: 6px;
}

.rp-ranking-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    color: var(--rp-text-2);
    font-size: 14px;
}
.rp-ranking-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.rp-ranking-meta-item i {
    color: var(--rp-accent-d);
}

/* Tabla */
.rp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}
.rp-table thead {
    background: var(--rp-bg-2);
}
.rp-table thead th {
    padding: 14px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--rp-text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--rp-border);
}
.rp-table tbody td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--rp-border);
    vertical-align: middle;
    font-size: 14px;
    color: var(--rp-text);
}
.rp-table tbody tr:last-child td { border-bottom: none; }
.rp-table tbody tr:hover {
    background: var(--rp-bg-2);
}

.rp-pos {
    font-weight: 800;
    font-size: 16px;
    width: 60px;
    text-align: center;
    color: var(--rp-text);
}
.rp-pos-medal-1 { color: #f59e0b; }
.rp-pos-medal-2 { color: #94a3b8; }
.rp-pos-medal-3 { color: #d97706; }

.rp-player-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}
.rp-player-name {
    font-weight: 600;
    color: var(--rp-text);
}
.rp-player-sub {
    font-size: 12px;
    color: var(--rp-text-3);
    margin-top: 2px;
}

.rp-stat-up    { color: var(--rp-success); font-weight: 700; }
.rp-stat-down  { color: var(--rp-danger);  font-weight: 700; }
.rp-stat-flat  { color: var(--rp-text-3);  font-weight: 700; }

.rp-points {
    font-weight: 800;
    font-size: 16px;
    color: var(--rp-text);
}

@media (max-width: 768px) {
    .rp-ranking-header { padding: 20px; }
    .rp-table thead th { padding: 10px 12px; font-size: 10px; }
    .rp-table tbody td { padding: 12px; font-size: 13px; }
    .rp-pos { width: 40px; font-size: 14px; }
    .rp-table .hide-mobile { display: none; }
}

/* ============================================================================
   2. BRACKET (cuadro de torneo)
   ============================================================================ */

.rp-bracket {
    background: white;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-lg);
    padding: 30px;
    overflow-x: auto;
}

.rp-bracket-rounds {
    display: flex;
    gap: 30px;
    min-width: max-content;
    align-items: stretch;
}

.rp-bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 240px;
    flex-shrink: 0;
}

.rp-bracket-round-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--rp-text-3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 16px;
}

.rp-match {
    background: var(--rp-bg-2);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    overflow: hidden;
    margin: 8px 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.rp-match:hover {
    border-color: var(--rp-accent);
    box-shadow: var(--rp-shadow);
}
.rp-match.is-winner-1 .rp-match-team-1 { background: rgba(22, 163, 74, 0.08); }
.rp-match.is-winner-1 .rp-match-team-1 .rp-match-team-name { color: var(--rp-accent-d); font-weight: 700; }
.rp-match.is-winner-2 .rp-match-team-2 { background: rgba(22, 163, 74, 0.08); }
.rp-match.is-winner-2 .rp-match-team-2 .rp-match-team-name { color: var(--rp-accent-d); font-weight: 700; }

.rp-match-team {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    border-bottom: 1px solid var(--rp-border);
}
.rp-match-team:last-child { border-bottom: none; }
.rp-match-team-name {
    color: var(--rp-text);
    font-weight: 500;
}
.rp-match-team-score {
    font-weight: 800;
    color: var(--rp-text);
    min-width: 24px;
    text-align: right;
}

/* Liguilla — grupos */
.rp-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.rp-group {
    background: white;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-lg);
    overflow: hidden;
}
.rp-group-header {
    padding: 14px 20px;
    background: var(--rp-bg-2);
    border-bottom: 1px solid var(--rp-border);
    font-weight: 700;
    color: var(--rp-text);
}

/* ============================================================================
   3. EVENT DETAILS - hero con imagen
   ============================================================================ */

.rp-event-hero {
    height: 380px;
    background-size: cover;
    background-position: center;
    background-color: var(--rp-bg-3);
    position: relative;
    border-radius: var(--rp-radius-lg);
    overflow: hidden;
    margin-bottom: 32px;
}
.rp-event-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(15, 23, 42, 0.8) 100%);
}
.rp-event-hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px;
    color: white;
    z-index: 2;
}
.rp-event-hero-content h1 {
    color: white !important;
    font-size: 2.5rem !important;
    margin-bottom: 12px;
}
.rp-event-hero-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
}
.rp-event-hero-meta-item { display: flex; align-items: center; gap: 6px; }

/* ============================================================================
   4. POSTER (cartel A4)
   ============================================================================ */

.rp-poster {
    width: 100%;
    max-width: 595px; /* A4 width @ 72dpi */
    aspect-ratio: 595 / 842;
    margin: 0 auto;
    background: white;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-lg);
    box-shadow: var(--rp-shadow-lg);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}
.rp-poster-header {
    padding: 40px 32px;
    background: var(--rp-primary);
    color: white;
    text-align: center;
}
.rp-poster-eyebrow {
    color: var(--rp-accent);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.rp-poster-title {
    font-size: 2rem !important;
    color: white !important;
    line-height: 1.1;
    margin-bottom: 16px;
}
.rp-poster-body {
    padding: 32px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.rp-poster-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.rp-poster-info-item {
    text-align: center;
    padding: 16px;
    background: var(--rp-bg-2);
    border-radius: var(--rp-radius);
}
.rp-poster-info-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--rp-text-3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
}
.rp-poster-info-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--rp-text);
}
.rp-poster-footer {
    padding: 20px 32px;
    background: var(--rp-bg-2);
    border-top: 1px solid var(--rp-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--rp-text-3);
}

/* Boton acción flotante para imprimir/descargar */
.rp-poster-actions {
    margin-top: 24px;
    text-align: center;
}

@media print {
    body * { visibility: hidden; }
    .rp-poster, .rp-poster * { visibility: visible; }
    .rp-poster {
        position: absolute;
        left: 0;
        top: 0;
        max-width: 100%;
        box-shadow: none;
    }
    .rp-poster-actions, nav, footer { display: none !important; }
}

/* ============================================================================
   5. CARDS PARA EVENT DETAILS
   ============================================================================ */
.rp-info-box {
    background: white;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}
.rp-info-box h3 {
    font-size: 1.1rem !important;
    margin-bottom: 16px !important;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rp-border);
}
.rp-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.rp-info-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--rp-border);
    font-size: 14px;
}
.rp-info-list li:last-child { border-bottom: none; }
.rp-info-list .label { color: var(--rp-text-3); }
.rp-info-list .value { font-weight: 600; color: var(--rp-text); }
