/* ==========================================================================
   WPSBS - HOJA DE ANOTACIÓN DE BÉISBOL v2.0 - FIX TOTAL
   ========================================================================== */

/* Contenedor y Tabla */
.wpsbs-scorecard-container {
    width: 100%;
    overflow-x: auto;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f8fafc;
    padding: 20px 0;
}

.wpsbs-scorecard-table {
    border-collapse: collapse;
    margin: 0 auto;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.wpsbs-scorecard-table th, 
.wpsbs-scorecard-table td {
    border: 1px solid #cbd5e1;
    text-align: center;
    padding: 0;
}

.wpsbs-scorecard-table th {
    background: #1a2a3a;
    color: white;
    padding: 10px 5px;
    font-size: 12px;
}

/* Columnas de Jugador */
.wpsbs-player-col {
    min-width: 180px;
    text-align: left !important;
    padding-left: 10px !important;
}

.wpsbs-player-select-dynamic {
    width: 140px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
}

.wpsbs-pos-input {
    width: 25px;
    text-align: center;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
}

/* ==========================================================================
   EL DIAMANTE DINÁMICO (SISTEMA DE LÍNEAS EXACTO)
   ========================================================================== */

.wpsbs-score-cell {
    width: 75px;
    height: 75px;
    position: relative;
    cursor: pointer;
    background: white;
}

.wpsbs-score-cell:hover {
    background-color: #f1f5f9;
}

/* El rombo base: Fondo gris claro y bordes transparentes */
.wpsbs-diamond-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 38px;
    height: 38px;
    transform: translate(-50%, -50%) rotate(45deg);
    background: #e5e7eb; /* El gris claro de tu diagrama */
    border: 3px solid transparent; /* Espacio reservado para las líneas negras */
    z-index: 1;
    box-sizing: border-box;
}

/* 
   MAPEO DE LÍNEAS SEGÚN TU DIAGRAMA (Rotación 45°):
   HIT (1B) -> Borde inferior-derecha (CSS: border-right)
   2B       -> Borde superior-derecha (CSS: border-top)
   3B       -> Borde superior-izquierda (CSS: border-left)
   HR       -> Borde inferior-izquierda (CSS: border-bottom)
*/

/* Hit (1B) - Solo la línea inferior derecha */
.reached-1b .wpsbs-diamond-bg {
    border-right-color: #000 !important;
}

/* Doble (2B) - Agrega la línea superior derecha */
.reached-2b .wpsbs-diamond-bg {
    border-top-color: #000 !important;
}

/* Triple (3B) - Agrega la línea superior izquierda */
.reached-3b .wpsbs-diamond-bg {
    border-left-color: #000 !important;
}

/* Home Run / Carrera - Completa el rombo con la línea inferior izquierda */
.reached-home .wpsbs-diamond-bg {
    border-bottom-color: #000 !important;
}

/* Centro oscuro - Solo aparece si se marca como carrera (is-run) */
.is-run .wpsbs-diamond-bg::after {
    content: '';
    position: absolute;
    top: 20%; 
    left: 20%;
    width: 60%; 
    height: 60%;
    background-color: #1a2a3a;
    z-index: 2;
}

/* Punto de RBI (CI) */
.wpsbs-score-cell.has-rbi::before {
    content: '';
    position: absolute;
    bottom: 12px;
    left: 50%;
    width: 6px;
    height: 6px;
    background-color: #1a2a3a;
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

/* Texto de la Jugada y Outs */
.wpsbs-play-text {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    font-weight: bold;
    color: #475569;
    z-index: 5;
    background: rgba(255,255,255,0.7);
    padding: 0 2px;
}

.wpsbs-out-text {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 11px;
    font-weight: 800;
    color: #DB0304;
    border: 1px solid #DB0304;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    line-height: 15px;
    text-align: center;
    z-index: 5;
}

/* ==========================================================================
   MODAL DE ANOTACIÓN (ESTILOS COMPLETOS)
   ========================================================================== */

#wpsbs-scoring-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.8);
    z-index: 9999;
}

.wpsbs-modal-content {
    background: white;
    width: 90%;
    max-width: 550px;
    margin: 30px auto;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.wpsbs-modal-header {
    background: #1a2a3a;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wpsbs-close-btn { 
    cursor: pointer; 
    font-size: 18px; 
}

.nomen-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.nomen-btn:hover { 
    background: #f8fafc; 
    border-color: #cbd5e1; 
}

.nomen-desc {
    font-size: 9px;
    color: #64748b;
    margin-top: 2px;
    font-weight: normal;
    text-align: center;
}

.wpsbs-btn-clear {
    cursor: pointer;
    transition: background 0.2s;
}
/* Contenedor relativo para posicionar el punto */
.wpsbs-score-cell {
    position: relative;
}

/* El punto de Out */
.wpsbs-out-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background-color: #ff0000; /* Rojo vibrante */
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
}

/* Contenedor de la tabla */
.wpsbs-table-responsive {
    overflow-x: auto;
    margin-top: 20px;
}

/* Estilo general de la tabla de roster */
.wpsbs-roster-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.wpsbs-roster-table th {
    background: #1a2a3a;
    color: #ffffff;
    padding: 12px 15px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wpsbs-roster-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #334155;
}

/* Alineación */
.txt-center { text-align: center; }

/* Celda del Jugador (Foto + Nombre) */
.wpsbs-player-cell {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    gap: 12px;
}

.wpsbs-player-photo-mini {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.wpsbs-player-name-table {
    font-weight: 600;
    font-size: 14px;
}

/* Resaltar al pasar el mouse */
.wpsbs-roster-table tbody tr:hover {
    background-color: #f8fafc;
}

.wpsbs-roster-table td strong {
    color: #0073aa;
}
/* --- Lógica de Imagen por Defecto --- */
.wpsbs-player-photo-mini, 
.wpsbs-team-photo, 
img[src=""], 
img:not([src]) {
    background-color: #e2e8f0;
    /* Usamos un SVG ligero de una silueta genérica */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%231a2a3a"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>');
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
    min-height: 40px;
    min-width: 40px;
    display: inline-block;
}

.wpsbs-calendar-wrapper {
    width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #444;
}

.wpsbs-game-card {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 12px 15px;
    border-bottom: 1px solid #edf2f7;
    transition: background 0.2s;
}

.wpsbs-game-card:hover {
    background: #fcfcfc;
}

/* Tipografía Ligera para Fecha */
.game-info {
    flex: 0 0 100px;
}

.game-date {
    display: block;
    font-size: 13px;
    font-weight: 400; /* Peso ligero */
    color: #1a2a3a;
}

.game-time {
    font-size: 11px;
    font-weight: 300; /* Muy ligero */
    color: #888;
}

/* Equipos */
.game-matchup {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.team {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.team.away { justify-content: flex-end; }
.team.home { justify-content: flex-start; }

.team-name {
    font-size: 14px;
    font-weight: 400; /* Eliminamos el bold pesado */
    color: #1a2a3a;
}

/* Marcador */
.game-score {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.score-num {
    font-size: 18px;
    font-weight: 300; /* Número estilizado y fino */
    color: #db0304;
}

.score-divider {
    padding: 0 4px;
    color: #cbd5e1;
}

.vs-label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 300;
}

/* Estado del juego sutil */
.game-status {
    flex: 0 0 110px;
    text-align: right;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    color: #64748b;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.status-dot.finished { background: #cbd5e1; }
.status-dot.scheduled { background: #e11d48; }

/* OPTIMIZACIÓN MÓVIL (Sin tablas) */
@media (max-width: 600px) {
    .wpsbs-game-card {
        flex-wrap: wrap;
        padding: 15px 10px;
    }
    .game-info {
        flex: 0 0 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    .game-matchup {
        width: 100%;
        order: 2;
    }
    .team-name {
        font-size: 12px;
    }
    .game-status {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        order: 3;
    }
}
/* Contenedor principal */
.wpsbs-roster-container {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

/* Filas con Flexbox para control total del ancho */
.wpsbs-header-row, 
.wpsbs-player-row {
    display: flex;
    width: 100%;
    border-bottom: 1px solid #f1f5f9;
}

/* Encabezado */
.wpsbs-header-row {
    background: #f8fafc;
    font-size: 9px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
}

/* Columnas: 34% para nombre, ~11% para cada stat (Total 100%) */
.col-main {
    width: 34%;
    padding: 8px 5px;
    display: flex;
    align-items: center;
}

.col-data {
    width: 11%;
    border-left: 1px solid #f1f5f9;
    position: relative; /* Para posicionar la sigla */
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
}

/* Siglas integradas (Estilo Captura) */
.inline-sigla {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 6.5px !important;
    font-weight: 800;
    color: #94a3b8;
    line-height: 1;
}

/* Valores numéricos */
.inline-valor {
    font-size: 10.5px !important;
    font-weight: 700;
    color: #1e293b;
    margin-top: 6px; /* Ajuste para que no choque con la sigla */
}

/* Avatar y Nombre */
.player-info {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.mini-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
}

.player-name {
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Corta nombres largos sin romper la fila */
}

/* Resalte AVG */
.highlight-avg {
    background-color: #f8fafc;
}
.highlight-avg .inline-valor {
    color: #2563eb;
}

/* Ocultar header en móvil para limpiar el diseño */
@media (max-width: 500px) {
    .wpsbs-header-row {
        display: none;
    }
}
/* Contenedor principal de lanzadores */
.wpsbs-pitcher-results {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px dashed #ddd;
    gap: 10px;
}

/* Estilo de las etiquetas (Badges) */
.pitcher-badge {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    flex: 1;
    min-width: 0; /* Crítico para que el truncado de texto funcione */
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.badge-label {
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 6px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.badge-name {
    font-size: 11px;
    color: #1e293b;
    padding: 6px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Esto pone los "..." si el nombre es muy largo */
    font-weight: 600;
}

/* Colores distintivos */
.pitcher-badge.win { border-left: 4px solid #22c55e; }
.pitcher-badge.win .badge-label { background: #22c55e; }

.pitcher-badge.loss { border-left: 4px solid #ef4444; }
.pitcher-badge.loss .badge-label { background: #ef4444; }

/* AJUSTE ESPECÍFICO PARA MÓVILES (Media Query) */
@media (max-width: 580px) {
    .wpsbs-pitcher-results {
        flex-direction: column; /* Se apilan verticalmente */
        align-items: stretch; /* Ocupan todo el ancho */
        gap: 8px;
    }

    .pitcher-badge {
        width: 100%;
        display: flex;
    }

    .badge-name {
        font-size: 12px; /* Un poco más grande en móvil para lectura */
        flex-grow: 1;
    }
}