/* Score Registration Page Styles */
.score-registration-container {
    /* min-height: 100vh; */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
}

/* Header Section */
.score-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem 0;
}

.score-title {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.score-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.match-info {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* Score Board */
.score-board {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 2rem 0; /* Restored padding for more space */
}

.score-board .container-fluid {
    height: 100%;
}

.score-board .row {
    /* min-height: 60vh;  Restored height */
    align-items: center;
}

/* Team Sections */
.team-section {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.team-content {
    text-align: center;
    width: 100%;
    /*max-width: 25rem;*/
}

/* Team Header - Logo, Score and Controls */
.team-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.team-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-logo {
    border: 0.25rem solid rgba(255, 255, 255, 0.8); /* Cambiado de 4px a rem */
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.2);
}

.team-logo-placeholder {
    width: 5rem; /* Cambiado de 80px a rem */
    height: 5rem;
    border-radius: 50%;
    border: 0.25rem solid rgba(255, 255, 255, 0.5); /* Cambiado de 4px a rem */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.team-name {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.team-institution {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Score Display */
.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Serving Indicator Styles */
.serving-indicator {
    position: absolute;
    top: -0.9375rem; /* Cambiado de -15px a rem */
    right: -0.9375rem; /* Cambiado de -15px a rem */
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border-radius: 50%;
    width: 2.8125rem; /* Cambiado de 45px a rem */
    height: 2.8125rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.25rem 0.9375rem rgba(238, 90, 36, 0.4);
    animation: servingPulse 2s infinite;
    z-index: 10;
    cursor: pointer;
    border: 0.125rem solid rgba(255, 255, 255, 0.3); /* Cambiado de 2px a rem */
}

.serving-indicator i {
    color: white;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

.serving-indicator .serve-text {
    font-size: 1.2rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Tooltip for serving indicator */
.serving-indicator:hover::after {
    content: "Equipo Sacando";
    position: absolute;
    bottom: -1.875rem; /* Cambiado de -30px a rem */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem; /* Cambiado de 4px 8px a rem */
    border-radius: 0.25rem; /* Cambiado de 4px a rem */
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 20;
}

@keyframes servingPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(238, 90, 36, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 6px 20px rgba(238, 90, 36, 0.6);
    }
}

.current-score {
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 5rem; /* Cambiado de 80px a rem */
    height: 5rem;
    line-height: 5rem; /* Cambiado de 80px a rem */
    text-align: center;
    border: 0.1875rem solid rgba(255, 255, 255, 0.3); /* Cambiado de 3px a rem */
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.current-score.updated {
    transform: scale(1.1);
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

/* Score Controls */
.score-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.score-btn {
    width: 3.125rem; /* Cambiado de 50px a rem */
    height: 3.125rem;
    border-radius: 50%;
    font-size: 1rem;
    border: none;
    box-shadow: 0 0.375rem 1.25rem rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.score-btn:hover {
    transform: translateY(-0.125rem); /* Cambiado de -2px a rem */
    box-shadow: 0 0.5rem 1.5625rem rgba(0, 0, 0, 0.4);
}

.score-btn:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

/* VS Section */
.vs-section {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.vs-content {
    text-align: center;
}

.vs-circle {
    width: 6.25rem; /* Cambiado de 100px a rem */
    height: 6.25rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 0.1875rem solid rgba(255, 255, 255, 0.3); /* Cambiado de 3px a rem */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    backdrop-filter: blur(10px);
}

.vs-text {
    color: white;
    font-size: 1.5rem;
    font-weight: 900;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.match-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.match-controls .btn {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.match-controls .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Mobile Actions */
.mobile-actions {
    padding: 1rem 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-actions .btn {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

/* Alert Container */
.alert-container {
    position: fixed;
    top: 1.25rem; /* Cambiado de 20px a rem */
    right: 1.25rem;
    z-index: 1050;
    max-width: 25rem; /* Cambiado de 400px a rem */
}

.alert {
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 0.625rem; /* Cambiado de 10px a rem */
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.2);
}

.alert-success {
    background: rgba(76, 175, 80, 0.9);
    color: white;
}

.alert-danger {
    background: rgba(244, 67, 54, 0.9);
    color: white;
}

/* Team A specific styling */
.team-a {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
}

/* Team B specific styling */
.team-b {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), rgba(255, 152, 0, 0.05));
}

/* Responsive Design */
@media (max-width: 992px) {
    .score-title {
        font-size: 2rem;
    }
    
    .team-name {
        font-size: 1.5rem;
    }
    
    .current-score {
        font-size: 3rem;
        width: 6.25rem; /* Cambiado de 100px a rem */
        height: 6.25rem;
        line-height: 6.25rem; /* Cambiado de 100px a rem */
    }
    
    .score-btn {
        width: 3.75rem; /* Cambiado de 60px a rem */
        height: 3.75rem;
        font-size: 1.2rem;
    }
    
    .team-section {
        padding: 1rem;
        margin-bottom: 2rem;
    }
    
    .vs-section {
        order: -1;
        padding: 1rem 0;
    }
    
    .vs-circle {
        width: 5rem; /* Cambiado de 80px a rem */
        height: 5rem;
        margin-bottom: 1rem;
    }
    
    .vs-text {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .score-title {
        font-size: 1.5rem;
    }
    
    .team-name {
        font-size: 1.2rem;
    }
    
    .current-score {
        font-size: 2.5rem;
        width: 5rem; /* Cambiado de 80px a rem */
        height: 5rem;
        line-height: 5rem; /* Cambiado de 80px a rem */
    }
    
    .score-btn {
        width: 3.125rem; /* Cambiado de 50px a rem */
        height: 3.125rem;
        font-size: 1rem;
    }
    
    .team-logo,
    .team-logo-placeholder {
        width: 6.25rem !important; /* Cambiado de 100px a rem */
        height: 6.25rem !important;
    }
}

/* Animation classes */
.score-update-animation {
    animation: scoreUpdate 0.6s ease-in-out;
}

@keyframes scoreUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Period-specific Styles */
.period-progress {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
}

.periods-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.period-tab {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    text-align: center;
    /* min-width: 120px; */
    transition: all 0.3s ease;
    cursor: pointer;
}

.period-tab:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.period-tab.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.period-tab.completed {
    background: rgba(40, 167, 69, 0.3);
    border-color: rgba(40, 167, 69, 0.7);
}

.period-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.period-scores {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.period-status {
    margin-top: 0.25rem;
}

.period-status .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

/* Current Period Info */
.current-period-info {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
}

.current-period-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.total-scores {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    font-weight: 500;
}

.total-score-a, .total-score-b {
    font-weight: 700;
    color: white;
    font-size: 1.3rem;
}

.total-score-a.updated, .total-score-b.updated {
    animation: scoreUpdate 0.6s ease-out;
}

/* Period Score Board Specific */
.period-score-board .score-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.period-controls {
    text-align: center;
}

.period-controls .btn {
    width: 100%;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.keyboard-hints {
    text-align: center;
}

.keyboard-hints kbd {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    margin: 0 0.1rem;
}

/* No Period Message */
.no-period-message {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
}

.no-period-message h3 {
    color: white;
    font-size: 2rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.no-period-message .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* Alert Container */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    max-width: 350px;
}

.alert-container .alert {
    margin-bottom: 0.5rem;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Period Score Animations */
@keyframes scoreUpdate {
    0% {
        transform: scale(1);
        color: inherit;
    }
    50% {
        transform: scale(1.2);
        color: #ffd700;
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    }
    100% {
        transform: scale(1);
        color: inherit;
    }
}

.score-update-animation {
    animation: scoreUpdate 0.6s ease-out;
}

/* Mobile Improvements for Periods */
@media (max-width: 768px) {
    .periods-tabs {
        padding: 0 1rem;
    }
    
    .period-tab {
        /* min-width: 100px; */
        padding: 0.5rem 0.75rem;
    }
    
    .current-period-title {
        font-size: 1.2rem;
    }
    
    .total-scores {
        font-size: 1rem;
    }
    
    .total-score-a, .total-score-b {
        font-size: 1.1rem;
    }
    
    .period-controls .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .keyboard-hints {
        display: none; /* Hide keyboard hints on mobile */
    }
}

/* Player Score Modal */

/* ==============================================
   TEAM LINEUP STYLES - MATRIZ 3x2 MEJORADA
   ============================================== */

.team-lineup {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.5rem; /* Aumenté el padding */
    margin-top: 1rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    /* min-height: 28.125rem;  Aumenté la altura mínima considerablemente */
}

.players-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 columnas para cada media cancha */
    grid-template-rows: 1fr 1fr 1fr; /* 3 filas */
    gap: 1.2rem; /* Aumenté el gap significativamente */
    width: 100%;
    /* max-width: 26.25rem;  Aumenté el ancho máximo */
    margin: 0 auto;
    /* height: 23.75rem;  Aumenté la altura considerablemente */
    padding: 0.25rem; /* Aumenté el padding */
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

/* FORMACIÓN DE CANCHA VISTA DESDE ARRIBA - AUMENTADA */
/* EQUIPO B (DERECHO): Las posiciones están correctas */
.team-b .player-card[data-position="2"] {
    grid-column: 1; /* Cerca de la red */
    grid-row: 1;    /* Fila 1 */
}
.team-b .player-card[data-position="3"] {
    grid-column: 1; /* Cerca de la red */
    grid-row: 2;    /* Fila 2 */
}
.team-b .player-card[data-position="4"] {
    grid-column: 1; /* Cerca de la red */
    grid-row: 3;    /* Fila 3 */
}
.team-b .player-card[data-position="1"] {
    grid-column: 2; /* Lejos de la red */
    grid-row: 1;    /* Fila 1 */
}
.team-b .player-card[data-position="6"] {
    grid-column: 2; /* Lejos de la red */
    grid-row: 2;    /* Fila 2 */
}
.team-b .player-card[data-position="5"] {
    grid-column: 2; /* Lejos de la red */
    grid-row: 3;    /* Fila 3 */
}

/* EQUIPO A (IZQUIERDO): Solo espejo horizontal (no vertical) */
.team-a .player-card[data-position="5"] {
    grid-column: 1; /* Lejos de la red */
    grid-row: 1;    /* Fila 1 */
}
.team-a .player-card[data-position="6"] {
    grid-column: 1; /* Lejos de la red */
    grid-row: 2;    /* Fila 2 */
}
.team-a .player-card[data-position="1"] {
    grid-column: 1; /* Lejos de la red */
    grid-row: 3;    /* Fila 3 */
}
.team-a .player-card[data-position="4"] {
    grid-column: 2; /* Cerca de la red */
    grid-row: 1;    /* Fila 1 */
}
.team-a .player-card[data-position="3"] {
    grid-column: 2; /* Cerca de la red */
    grid-row: 2;    /* Fila 2 */
}
.team-a .player-card[data-position="2"] {
    grid-column: 2; /* Cerca de la red */
    grid-row: 3;    /* Fila 3 */
}

/* Player Cards - Tamaño aumentado significativamente */
.player-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 1rem; /* Aumenté el padding considerablemente */
    text-align: center;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    /* min-height: 120px;  Aumenté la altura mínima */
    /* max-height: 140px;  Aumenté la altura máxima */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
    margin: 0.5rem; /* Cambiado de 8px a rem */
}

.clickable-player {
    cursor: pointer;
    transition: all 0.3s ease;
}

.clickable-player:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.player-card .player-photo-container {
    position: relative;
    display: inline-block;
    margin-bottom: 0.8rem; /* Aumenté el margen */
}

.player-card .player-photo {
    width: 4.375rem; /* Cambiado de 70px a rem */
    height: 4.375rem;
    border-radius: 50%;
    object-fit: cover;
    border: 0.1875rem solid rgba(255, 255, 255, 0.5); /* Cambiado de 3px a rem */
    background: rgba(255, 255, 255, 0.1);
}

.player-card .player-photo-placeholder {
    width: 4.375rem; /* Cambiado de 70px a rem */
    height: 4.375rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    border: 0.1875rem solid rgba(255, 255, 255, 0.3); /* Cambiado de 3px a rem */
}

.player-card .player-number {
    position: absolute;
    bottom: -0.25rem; /* Cambiado de -4px a rem */
    right: -0.25rem; /* Cambiado de -4px a rem */
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 1.75rem; /* Cambiado de 28px a rem */
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem; /* Aumenté el tamaño de fuente */
    font-weight: bold;
    border: 0.1875rem solid white; /* Cambiado de 3px a rem */
    box-shadow: 0 0.1875rem 0.5rem rgba(0, 0, 0, 0.3);
    z-index: 10; /* Asegurar que esté por encima */
}

.player-card .player-info {
    color: white;
}

.player-card .player-name {
    font-size: 0.9rem; /* Aumenté el tamaño de fuente */
    font-weight: 600;
    margin-bottom: 0.3rem; /* Aumenté el margen */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
    /* max-height: 2.4em; */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.player-card .player-position {
    font-size: 0.8rem; /* Aumenté el tamaño de fuente */
    opacity: 0.9;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.3rem 0.8rem; /* Aumenté el padding */
    border-radius: 12px;
    display: inline-block;
    white-space: nowrap;
}

/* Position-based styling para mejor identificación visual */
.player-card[data-position="1"] {
    border-left: 4px solid #e74c3c;
}

.player-card[data-position="2"] {
    border-left: 4px solid #3498db;
}

.player-card[data-position="3"] {
    border-left: 4px solid #2ecc71;
}

.player-card[data-position="4"] {
    border-left: 4px solid #f39c12;
}

.player-card[data-position="5"] {
    border-left: 4px solid #9b59b6;
}

.player-card[data-position="6"] {
    border-left: 4px solid #1abc9c;
}

.no-players {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
}

/* Mobile responsiveness - Manteniendo la matriz con tamaños aumentados */
@media (max-width: 768px) {
    .players-grid {
        gap: 0.8rem;
        /* max-width: 20rem;  Cambiado de 320px a rem */
        height: 100%; /* Cambiado de 280px a rem */
        padding: 0.25rem;
        margin: 0.25rem; /* Cambiado de 4px a rem */
    }
    
    .player-card {
        padding: 0.6rem;
        /* min-height: 5.3125rem;  Cambiado de 85px a rem */
        /* max-height: 6.25rem;  Cambiado de 100px a rem */
        margin: 0.25rem; /* Cambiado de 4px a rem */
    }
    
    .player-card .player-photo,
    .player-card .player-photo-placeholder {
        width: 100%; /* Cambiado de 50px a rem */
        height: 100%;
    }
    
    .player-card .player-number {
        width: 100%; /* Cambiado de 22px a rem */
        height: 100%;
        font-size: 0.7rem;
        bottom: -0.1875rem; /* Cambiado de -3px a rem */
        right: -0.1875rem;
    }
    
    .player-card .player-name {
        font-size: 0.75rem;
    }
    
    .player-card .player-position {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }
    
    .team-lineup {
        padding: 0.6rem;
        /* min-height: 21.875rem;  Cambiado de 350px a rem */
    }
}

@media (max-width: 576px) {
    .players-grid {
        gap: 0.6rem;
        /* max-width: 17.5rem;  Cambiado de 280px a rem */
        height: 100%; /* Cambiado de 240px a rem */
        padding: 0.6rem;
    }
    
    .player-card {
        padding: 0.5rem;
        /* min-height: 4.375rem;  Cambiado de 70px a rem */
        /* max-height: 5rem;  Cambiado de 80px a rem */
    }
    
    .player-card .player-photo,
    .player-card .player-photo-placeholder {
        width: 2.5rem; /* Cambiado de 40px a rem */
        height: 2.5rem;
    }
    
    .player-card .player-number {
        width: 1.125rem; /* Cambiado de 18px a rem */
        height: 1.125rem;
        font-size: 0.6rem;
        bottom: -0.125rem; /* Cambiado de -2px a rem */
        right: -0.125rem;
    }
    
    .player-card .player-name {
        font-size: 0.7rem;
    }
    
    .player-card .player-position {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }
    
}

/* Player Score Modal */
.player-modal-photo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.player-modal-photo img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border: 3px solid #dee2e6;
    border-radius: 50%;
    display: block;
}

.player-modal-photo div {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #dee2e6;
    border-radius: 50%;
}

/* Ensure modal photo visibility */
#modalPlayerPhoto {
    /* max-width: 100px; */
    /* max-height: 100px; */
    visibility: visible !important;
}

#modalPlayerPhoto.d-none {
    display: none !important;
}

#modalPlayerPhotoPlaceholder.d-none {
    display: none !important;
}

/* Modal fallback styles */
#playerScoreModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    display: none;
}

#playerScoreModal.show {
    display: block !important;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

/* Ensure close button is clickable */
.btn-close {
    cursor: pointer;
    z-index: 1060;
    position: relative;
}

.btn-close:hover {
    opacity: 0.75;
}

/* Modal dialog positioning */
.modal-dialog {
    position: relative;
    z-index: 1055;
}

/* Match finished styles */
.winner-message {
    padding: 2rem 0;
}

.winner-message .alert {
    border: none;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.3);
}

.winner-message h3 {
    color: #155724;
    margin-bottom: 1rem;
}

.winner-message h4 {
    color: #155724;
    margin-bottom: 0.5rem;
}

/* Disabled player cards */
.player-card:not(.clickable-player) {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.player-card:not(.clickable-player):hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===========================================
   SUBSTITUTION SYSTEM STYLES
   =========================================== */

/* Substitution Controls */
.substitution-controls {
    text-align: center;
}

.substitution-btn {
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 25px;
    padding: 0.5rem 1.2rem;
    transition: all 0.3s ease;
    border: 2px solid #ffc107;
    background: linear-gradient(45deg, #ffc107, #ffca2c);
    color: #212529;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.substitution-btn:hover {
    background: linear-gradient(45deg, #ffca2c, #ffd60a);
    border-color: #ffca2c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
    color: #212529;
}

.substitution-btn:disabled {
    background: #6c757d;
    border-color: #6c757d;
    color: #fff;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Substitution Modal */
#substitutionModal .modal-header {
    background: linear-gradient(45deg, #ffc107, #ffca2c);
    color: #212529;
    border-bottom: 1px solid #dee2e6;
}

#substitutionModal .modal-header .modal-title {
    font-weight: 700;
    font-size: 1.3rem;
}

#substitutionModal .modal-body {
    padding: 2rem;
}

/* Player Selection */
.form-select {
    border-radius: 0.5rem;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-select:focus {
    border-color: #ffc107;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

/* Player Info Displays */
#playerOutInfo,
#playerInInfo {
    background: rgba(248, 249, 250, 0.8);
    border-radius: 0.3rem;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid #17a2b8;
}

/* Exchange Icon */
.fa-exchange {
    color: #ffc107;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Substitutions History */
#substitutionsHistory .list-group-item {
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
    background: rgba(248, 249, 250, 0.5);
    transition: all 0.2s ease;
}

#substitutionsHistory .list-group-item:hover {
    background: rgba(248, 249, 250, 0.8);
    transform: translateX(5px);
}

#substitutionsHistory .btn-outline-danger {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Substitution Alerts */
.alert-info {
    background: linear-gradient(45deg, rgba(23, 162, 184, 0.1), rgba(23, 162, 184, 0.05));
    border: 1px solid rgba(23, 162, 184, 0.2);
    color: #0c5460;
    border-radius: 0.5rem;
}

#substitutionError {
    border-radius: 0.5rem;
    background: linear-gradient(45deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.05));
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* Alert Container */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.alert-container .alert {
    margin-bottom: 10px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal Footer */
#substitutionModal .modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #dee2e6;
}

#substitutionModal .btn {
    border-radius: 0.5rem;
    padding: 0.7rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

#executeSubstitution {
    background: linear-gradient(45deg, #ffc107, #ffca2c);
    border-color: #ffc107;
    color: #212529;
}

#executeSubstitution:hover:not(:disabled) {
    background: linear-gradient(45deg, #ffca2c, #ffd60a);
    border-color: #ffca2c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

#executeSubstitution:disabled {
    background: #6c757d;
    border-color: #6c757d;
    color: #fff;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive Design for Substitution Modal */
@media (max-width: 768px) {
    #substitutionModal .modal-body {
        padding: 1rem;
    }
    
    .substitution-btn {
        font-size: 0.8rem;
        padding: 0.4rem 1rem;
    }
    
    #substitutionModal .modal-header .modal-title {
        font-size: 1.1rem;
    }
}

/* Modal Fallback Styles (when Bootstrap is not available) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1055;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}

.modal.show {
    display: block !important;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    opacity: 0.5;
}

.modal-backdrop.show {
    opacity: 0.5;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem;
    pointer-events: none;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    outline: 0;
}

.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: calc(0.375rem - 1px);
    border-top-right-radius: calc(0.375rem - 1px);
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem;
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: calc(0.375rem - 1px);
    border-bottom-left-radius: calc(0.375rem - 1px);
}

.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em 0.25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='m.235 1.453.338-.207a.25.25 0 0 1 .384.058l1.708 2.03L4.7 1.401a.25.25 0 0 1 .384-.058l.338.207a.25.25 0 0 1 .058.384L3.45 4l2.03 2.067a.25.25 0 0 1-.058.384l-.338.207a.25.25 0 0 1-.384-.058L2.667 4.57.634 6.6a.25.25 0 0 1-.384.058L.013 6.451a.25.25 0 0 1-.058-.384L2.085 4L.055 1.933a.25.25 0 0 1 .058-.384z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    border: 0;
    border-radius: 0.375rem;
    opacity: 0.5;
    cursor: pointer;
}

.btn-close:hover {
    opacity: 0.75;
}