/* Títulos de gráficos clickeables */
.chart-title-clickable {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.chart-title-clickable:hover {
    color: #3182ce;
    transform: translateY(-2px);
}

.fullscreen-icon {
    font-size: 0.8rem;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.chart-title-clickable:hover .fullscreen-icon {
    opacity: 1;
}

/* Modal de pantalla completa */
.fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    animation: modalFadeIn 0.3s ease;
}

.fullscreen-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 95%;
    height: 90%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #e2e8f0;
    background: linear-gradient(145deg, #f8fafc, #edf2f7);
}

.modal-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
}

.close-modal {
    background: #e53e3e;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: #c53030;
    transform: scale(1.1);
}

.modal-chart-container {
    flex: 1;
    padding: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-chart-container canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
}

/* Gráficos individuales clickeables */
.individual-chart-clickable {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.individual-chart-clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.individual-chart-clickable::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 8px;
    border-radius: 15px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.individual-chart-clickable:hover::after {
    opacity: 1;
}

/* Animaciones */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive para modal */
@media (max-width: 768px) {
    .modal-content {
        width: 98%;
        height: 95%;
        border-radius: 15px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .modal-chart-container {
        padding: 15px;
    }
    
    .close-modal {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .fullscreen-icon {
        font-size: 0.7rem;
    }
    
    .chart-title-clickable {
        gap: 8px;
    }
}

/* Modal de edición móvil */
.mobile-edit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    animation: modalFadeIn 0.3s ease;
}

.mobile-edit-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-edit-content {
    background: white;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mobile-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(145deg, #4299e1, #3182ce);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-edit-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.close-mobile-edit {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-mobile-edit:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.mobile-edit-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Información del participante */
.participant-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(145deg, #f8fafc, #edf2f7);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.participant-avatar {
    font-size: 3rem;
    color: #4299e1;
}

.participant-details h3 {
    margin: 0 0 5px 0;
    font-size: 1.3rem;
    color: #2d3748;
    font-weight: 700;
}

.participant-total {
    font-size: 1.1rem;
    color: #4299e1;
    font-weight: 600;
}

/* Campos de edición móvil */
.mobile-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mobile-field {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.mobile-field.has-changes {
    border-color: #f6ad55;
    background: #fffbf0;
}

.mobile-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.mobile-field-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-field-points {
    background: #4299e1;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.mobile-field-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.mobile-decrement-btn, .mobile-increment-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.mobile-decrement-btn {
    background: linear-gradient(145deg, #fc8181, #e53e3e);
    color: white;
}

.mobile-increment-btn {
    background: linear-gradient(145deg, #68d391, #38a169);
    color: white;
}

.mobile-decrement-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(229, 62, 62, 0.3);
}

.mobile-increment-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(56, 161, 105, 0.3);
}

.mobile-decrement-btn:active {
    transform: translateY(-1px) scale(0.95);
}

.mobile-increment-btn:active {
    transform: translateY(-1px) scale(0.95);
}

.mobile-field-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    min-width: 80px;
    text-align: center;
    padding: 10px;
    background: #f7fafc;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

.mobile-field-description {
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
    margin-top: 10px;
    font-style: italic;
}

/* Acciones del modal móvil */
.mobile-edit-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.save-changes-btn, .cancel-changes-btn {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.save-changes-btn {
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    box-shadow: 0 6px 20px rgba(56, 161, 105, 0.3);
}

.save-changes-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(56, 161, 105, 0.4);
}

.cancel-changes-btn {
    background: linear-gradient(145deg, #cbd5e0, #a0aec0);
    color: #4a5568;
}

.cancel-changes-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(145deg, #a0aec0, #718096);
    color: white;
}

/* Responsive para el modal móvil */
@media (min-width: 769px) {
    .mobile-edit-content {
        width: 90%;
        height: 90%;
        border-radius: 20px;
        margin: auto;
    }
    
    .mobile-edit-header {
        border-radius: 20px 20px 0 0;
    }
    
    .mobile-edit-body {
        border-radius: 0 0 20px 20px;
    }
}

@media (max-width: 480px) {
    .mobile-edit-body {
        padding: 15px;
        gap: 20px;
    }
    
    .participant-info {
        padding: 15px;
        gap: 12px;
    }
    
    .participant-avatar {
        font-size: 2.5rem;
    }
    
    .mobile-field {
        padding: 15px;
    }
    
    .mobile-decrement-btn, .mobile-increment-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .mobile-field-value {
        font-size: 2rem;
        min-width: 70px;
        padding: 8px;
    }
    
    .mobile-edit-actions {
        gap: 12px;
    }
    
    .save-changes-btn, .cancel-changes-btn {
        padding: 12px;
        font-size: 1rem;
    }
}

/* Header de resultados con botón */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h2 {
    margin: 0;
    flex: 1;
}

.action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.refresh-btn {
    background: linear-gradient(145deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
    background: linear-gradient(145deg, #3182ce, #2c5282);
}

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

.refresh-btn i {
    transition: transform 0.3s ease;
}

.refresh-btn:hover i {
    transform: rotate(180deg);
}

.add-participant-btn {
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-participant-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 161, 105, 0.4);
    background: linear-gradient(145deg, #38a169, #2f855a);
}

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

/* Modal para agregar participante */
.add-participant-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10001;
    animation: modalFadeIn 0.3s ease;
}

.add-participant-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-participant-content {
    background: white;
    border-radius: 20px;
    width: 95%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.add-participant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
}

.add-participant-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.close-add-participant {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-add-participant:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.add-participant-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

/* Formulario */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3748;
    font-size: 1rem;
}

.form-group label i {
    color: #4299e1;
    margin-right: 8px;
}

.form-group input[type="text"],
.form-group input[type="date"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: #f8fafc;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus {
    outline: none;
    border-color: #4299e1;
    background: white;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.form-help {
    color: #718096;
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
}

/* Puntuación inicial */
.initial-scores {
    margin-top: 30px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
}

.initial-scores h3 {
    margin: 0 0 10px 0;
    color: #2d3748;
    font-size: 1.1rem;
}

.scores-description {
    color: #718096;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.initial-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.score-field {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.score-field label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.increment-info {
    background: #4299e1;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.score-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-btn {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-btn.plus {
    background: #48bb78;
    color: white;
}

.score-btn.minus {
    background: #e53e3e;
    color: white;
}

.score-btn:hover {
    transform: scale(1.1);
}

.score-btn:active {
    transform: scale(0.95);
}

.score-input-group input {
    flex: 1;
    text-align: center;
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    background: #f8fafc;
    min-width: 60px;
}

.total-preview {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    font-size: 1.1rem;
    border: 2px solid #4299e1;
    color: #2d3748;
}

.total-preview strong {
    color: #4299e1;
    font-size: 1.3rem;
}

/* Acciones del modal */
.add-participant-actions {
    display: flex;
    gap: 15px;
    padding: 20px 25px;
    background: #f8fafc;
    border-top: 2px solid #e2e8f0;
}

.btn-add-participant,
.btn-cancel-add {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-participant {
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.3);
}

.btn-add-participant:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 161, 105, 0.4);
}

.btn-cancel-add {
    background: linear-gradient(145deg, #cbd5e0, #a0aec0);
    color: #4a5568;
}

.btn-cancel-add:hover {
    background: linear-gradient(145deg, #a0aec0, #718096);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .results-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .add-participant-btn {
        justify-content: center;
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .add-participant-content {
        width: 98%;
        max-height: 95vh;
        border-radius: 15px;
    }
    
    .add-participant-header {
        padding: 15px 20px;
    }
    
    .add-participant-header h2 {
        font-size: 1.2rem;
    }
    
    .add-participant-body {
        padding: 20px;
    }
    
    .initial-scores-grid {
        grid-template-columns: 1fr;
    }
    
    .add-participant-actions {
        flex-direction: column;
        padding: 15px 20px;
    }
}

/* Instrucciones responsivas */
.mobile-instructions {
    display: none;
}

/* Indicador de guardado */
.save-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    padding: 10px 15px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.3);
    z-index: 1000;
    transform: translateX(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.save-indicator.show {
    transform: translateX(0);
    opacity: 1;
}

.save-indicator i {
    margin-right: 5px;
}

@media (max-width: 768px), (pointer: coarse) {
    .desktop-instructions {
        display: none;
    }
    
    .mobile-instructions {
        display: inline;
    }
}

/* Controles de incremento personalizados para móviles */
.input-with-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
}

.increment-btn, .decrement-btn {
    background: #4299e1;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

.increment-btn:hover, .decrement-btn:hover {
    background: #3182ce;
    transform: scale(0.9);
}

.increment-btn:active, .decrement-btn:active {
    transform: scale(0.7);
    background: #2c5282;
}

.decrement-btn {
    background: #e53e3e;
}

.decrement-btn:hover {
    background: #c53030;
}

.decrement-btn:active {
    background: #9c1c1c;
}

/* Mostrar controles cuando la fila está en modo edición - versión compatible */
.input-with-controls.editing-row .increment-btn,
.input-with-controls.editing-row .decrement-btn {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* Estilos específicos para móviles */
@media (max-width: 768px) {
    .input-with-controls {
        gap: 1px;
    }
    
    .increment-btn, .decrement-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
        border-radius: 3px;
    }
    
    .score-input {
        text-align: center;
        min-width: 35px;
        padding: 2px 4px;
        font-size: 0.8rem;
    }
}

/* Estilos para móviles muy pequeños */
@media (max-width: 480px) {
    .input-with-controls {
        gap: 1px;
    }
    
    .increment-btn, .decrement-btn {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .score-input {
        min-width: 30px;
        padding: 1px 2px;
        font-size: 0.75rem;
    }
}