/* Sistema de Votaciones - Estilos */

/* Botón de votaciones en header */
#votacionesHeaderButton {
    display: none; /* Oculto por defecto, se muestra solo para director */
    position: relative;
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    border: 1px solid #34495e;
    color: #ecf0f1;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    z-index: 999;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    align-items: center;
    gap: 4px;
    margin-left: auto;
    margin-right: 8px;
}

#votacionesHeaderButton i {
    font-size: 16px;
}

#votacionesHeaderButton:hover {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

#votacionesControlButton {
    color: #ecf0f1;
}

#votacionesControlButton .votaciones-icon-svg {
    width: 1em;
    height: 1em;
    display: block;
}

/* Modal de Gestión de Votaciones */
#modalGestionVotaciones {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

#modalGestionVotaciones.active {
    display: flex;
}

.votaciones-modal-content {
    background: linear-gradient(180deg, #1e2936 0%, #16202b 100%);
    border: 1px solid #2c3e50;
    border-radius: 12px;
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.votaciones-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(44, 62, 80, 0.3);
}

.votaciones-modal-header h2 {
    margin: 0;
    color: #ecf0f1;
    font-size: 18px;
    font-weight: 600;
}

.votaciones-close-btn {
    background: transparent;
    border: none;
    color: #95a5a6;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.votaciones-close-btn:hover {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.votaciones-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.votaciones-seccion {
    margin-bottom: 28px;
}

.votaciones-seccion h3 {
    color: #bdc3c7;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.votaciones-input-group {
    margin-bottom: 16px;
}

.votaciones-input-group label {
    display: block;
    color: #95a5a6;
    font-size: 12px;
    margin-bottom: 6px;
    font-weight: 500;
}

.votaciones-input-group input,
.votaciones-input-group textarea,
.votaciones-input-group select {
    width: 100%;
    background: #0d1117;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.votaciones-input-group input:focus,
.votaciones-input-group textarea:focus,
.votaciones-input-group select:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.votaciones-input-group textarea {
    resize: vertical;
    min-height: 70px;
}

.votaciones-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.votaciones-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    transform: translateY(-1px);
}

.votaciones-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.votaciones-btn-secondary {
    background: linear-gradient(135deg, #7f8c8d 0%, #5d6d7e 100%);
    box-shadow: 0 2px 6px rgba(127, 140, 141, 0.3);
}

.votaciones-btn-secondary:hover {
    background: linear-gradient(135deg, #5d6d7e 0%, #4a5d6e 100%);
}

.votaciones-lista {
    list-style: none;
    margin: 0;
    padding: 0;
}

.votaciones-lista-item {
    background: rgba(13, 17, 23, 0.6);
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.votaciones-lista-item:hover {
    background: rgba(13, 17, 23, 0.9);
    border-color: #3d444d;
}

.votaciones-lista-item-info {
    flex: 1;
}

.votaciones-lista-item-titulo {
    color: #c9d1d9;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.votaciones-lista-item-meta {
    color: #8b949e;
    font-size: 11px;
}

.votaciones-lista-item-acciones {
    display: flex;
    gap: 8px;
}

.votaciones-btn-small {
    padding: 6px 12px;
    font-size: 11px;
}

.votaciones-btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
}

.votaciones-btn-danger:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

.votaciones-empty {
    text-align: center;
    color: #6c757d;
    padding: 40px 20px;
    font-size: 13px;
}

/* Modal de Control de Votaciones */
#modalControlVotaciones {
    display: none;
    position: fixed;
    top: 88px;
    right: 20px;
    inset: auto;
    background: transparent !important;
    z-index: 10000;
    width: min(820px, calc(100vw - 24px));
    backdrop-filter: none;
}

#modalControlVotaciones.active {
    display: block;
}

.votaciones-control-content {
    background: linear-gradient(180deg, #1e2936 0%, #16202b 100%);
    border: 1px solid #2c3e50;
    border-radius: 12px;
    width: 100%;
    max-width: none;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
}

.votaciones-control-header {
    padding: 10px 14px;
    cursor: move;
    user-select: none;
}

.votaciones-control-header.dragging {
    cursor: grabbing;
}

.votaciones-control-header h2 {
    font-size: 16px;
}

.votaciones-control-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#btnCopiarLinkReunionOverlay {
    padding: 6px 10px;
}

/* Overlay de Votación para Participantes */
#votacionOverlay {
    display: none;
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, rgba(18, 26, 35, 0.98) 0%, rgba(14, 20, 27, 0.98) 100%);
    border: 1px solid #3b4a5a;
    border-radius: 12px;
    padding: 10px 12px;
    z-index: 15000;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
    min-width: 560px;
    max-width: calc(100vw - 20px);
}

#votacionOverlay.active {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: votacionSlideIn 0.3s ease-out;
}

@keyframes votacionSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.votacion-overlay-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.votacion-overlay-titulo {
    color: #ecf0f1;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    text-align: left;
    line-height: 1.4;
}

.votacion-overlay-timer {
    color: #d3e3f5;
    background: rgba(13, 20, 29, 0.8);
    border: 1px solid rgba(115, 146, 178, 0.45);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    padding: 4px 8px;
    white-space: nowrap;
}

.votacion-overlay-botones {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    flex-wrap: nowrap;
}

.votacion-btn-votar {
    min-width: 88px;
    padding: 7px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
    border: 1px solid transparent;
}

.votacion-btn-votar:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.36);
}

.votacion-btn-apruebo {
    background: linear-gradient(135deg, #18a558 0%, #0f8042 100%) !important;
    color: #fff !important;
    border-color: #0b6433;
}

.votacion-btn-apruebo:hover {
    background: linear-gradient(135deg, #0f8042 0%, #0b6433 100%);
}

.votacion-btn-rechazo {
    background: linear-gradient(135deg, #cc2f2f 0%, #a42222 100%) !important;
    color: #fff !important;
    border-color: #7e1818;
}

.votacion-btn-rechazo:hover {
    background: linear-gradient(135deg, #a42222 0%, #7e1818 100%);
}

.votacion-btn-abstencion {
    background: linear-gradient(135deg, #f1c40f 0%, #d39f00 100%) !important;
    color: #2e2a17 !important;
    border-color: #ab8000;
}

.votacion-btn-votar.votado {
    opacity: 0.45;
    filter: grayscale(0.15);
}

.votacion-btn-votar.votado-activo {
    opacity: 1;
    filter: none;
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.42), 0 7px 18px rgba(0, 0, 0, 0.42);
}

.votacion-overlay-estado {
    color: #d7f5e2;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    background: rgba(24, 165, 88, 0.2);
    border: 1px solid rgba(24, 165, 88, 0.5);
    border-radius: 999px;
    padding: 4px 8px;
    white-space: nowrap;
}

.votacion-btn-abstencion:hover {
    background: linear-gradient(135deg, #d39f00 0%, #ab8000 100%);
}

/* Grilla de Votos en Tiempo Real */
.votaciones-grilla {
    margin-top: 24px;
    background: rgba(13, 17, 23, 0.6);
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.votaciones-grilla h4 {
    color: #bdc3c7;
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.votaciones-lista-item-resumen {
    align-items: flex-start;
    cursor: pointer;
}

.votaciones-lista-item-resumen .votaciones-lista-item-acciones {
    flex-shrink: 0;
    margin-left: 10px;
}

.votaciones-titulo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.votaciones-toggle-hint {
    color: #8bb5dc;
    background: rgba(27, 58, 84, 0.45);
    border: 1px solid rgba(86, 137, 175, 0.55);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.25px;
    padding: 2px 8px;
    white-space: nowrap;
}

.votaciones-control-detalle {
    max-height: 400px;
    opacity: 1;
    overflow: hidden;
    margin-top: 6px;
    transition: max-height 0.2s ease, opacity 0.2s ease, margin-top 0.2s ease;
}

.votaciones-lista-item-resumen.is-collapsed .votaciones-control-detalle {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

.votaciones-lista-item-resumen.activa {
    border-color: rgba(46, 204, 113, 0.65);
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.18), 0 8px 22px rgba(7, 20, 12, 0.3);
    background: linear-gradient(180deg, rgba(10, 24, 16, 0.45), rgba(13, 17, 23, 0.75));
}

.votacion-activa-linea {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 4px;
}

.votacion-activa-badge {
    background: rgba(46, 204, 113, 0.15);
    color: #68f0a5;
    border: 1px solid rgba(46, 204, 113, 0.55);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 3px 8px;
}

.votacion-activa-timer {
    color: #d6f5e2;
    background: rgba(10, 24, 16, 0.5);
    border: 1px solid rgba(115, 146, 178, 0.45);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    white-space: nowrap;
}

.votaciones-resumen-totales {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.resumen-chip {
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
}

.resumen-apruebo {
    background: rgba(24, 165, 88, 0.15);
    color: #5ae08f;
    border: 1px solid rgba(24, 165, 88, 0.5);
}

.resumen-abstencion {
    background: rgba(241, 196, 15, 0.15);
    color: #f4cd40;
    border: 1px solid rgba(241, 196, 15, 0.5);
}

.resumen-rechazo {
    background: rgba(204, 47, 47, 0.15);
    color: #ff7d7d;
    border: 1px solid rgba(204, 47, 47, 0.5);
}

.resumen-total {
    background: rgba(116, 139, 160, 0.2);
    color: #cdd8e1;
    border: 1px solid rgba(116, 139, 160, 0.5);
}

.votaciones-resumen-detalle {
    margin-top: 10px;
    max-height: 130px;
    overflow-y: auto;
    border: 1px solid rgba(116, 139, 160, 0.25);
    border-radius: 6px;
    padding: 8px;
    background: rgba(7, 12, 18, 0.55);
    color: #c9d1d9;
    font-size: 12px;
    line-height: 1.4;
}

.votaciones-grilla-lista {
    list-style: none;
    margin: 0;
    padding: 0;
}

.votaciones-grilla-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 13px;
}

.votaciones-grilla-item-nombre {
    color: #c9d1d9;
    font-weight: 500;
}

.votaciones-grilla-item-voto {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.voto-apruebo {
    background: rgba(39, 174, 96, 0.2);
    border-left: 3px solid #27ae60;
}

.voto-apruebo .votaciones-grilla-item-voto {
    background: #27ae60;
    color: #fff;
}

.voto-rechazo {
    background: rgba(44, 62, 80, 0.2);
    border-left: 3px solid #2c3e50;
}

.voto-rechazo .votaciones-grilla-item-voto {
    background: #2c3e50;
    color: #fff;
}

.voto-abstencion {
    background: rgba(214, 137, 16, 0.2);
    border-left: 3px solid #d68910;
}

.voto-abstencion .votaciones-grilla-item-voto {
    background: #d68910;
    color: #fff;
}

/* Resultados de Votación */
.votaciones-resultados {
    background: linear-gradient(180deg, rgba(30, 41, 54, 0.95) 0%, rgba(22, 32, 43, 0.95) 100%);
    border: 2px solid #27ae60;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
}

.votaciones-resultados h3 {
    color: #ecf0f1;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 24px 0;
}

.votaciones-resultados-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.votaciones-resultado-item {
    background: rgba(13, 17, 23, 0.8);
    border-radius: 8px;
    padding: 20px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.votaciones-resultado-item.ganador {
    border-color: #27ae60;
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.3);
}

.votaciones-resultado-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.votaciones-resultado-valor {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.resultado-apruebo .votaciones-resultado-label {
    color: #27ae60;
}

.resultado-apruebo .votaciones-resultado-valor {
    color: #27ae60;
}

.resultado-rechazo .votaciones-resultado-label {
    color: #7f8c8d;
}

.resultado-rechazo .votaciones-resultado-valor {
    color: #bdc3c7;
}

.resultado-abstencion .votaciones-resultado-label {
    color: #d68910;
}

.resultado-abstencion .votaciones-resultado-valor {
    color: #d68910;
}

/* Scrollbar personalizado */
.votaciones-modal-body::-webkit-scrollbar,
.votaciones-grilla::-webkit-scrollbar {
    width: 8px;
}

.votaciones-modal-body::-webkit-scrollbar-track,
.votaciones-grilla::-webkit-scrollbar-track {
    background: rgba(13, 17, 23, 0.5);
    border-radius: 4px;
}

.votaciones-modal-body::-webkit-scrollbar-thumb,
.votaciones-grilla::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

.votaciones-modal-body::-webkit-scrollbar-thumb:hover,
.votaciones-grilla::-webkit-scrollbar-thumb:hover {
    background: #3d444d;
}

/* Responsivo */
@media (max-width: 768px) {
    #votacionesHeaderButton {
        right: 10px;
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .votaciones-modal-content,
    .votaciones-control-content {
        width: 95%;
        max-height: 90vh;
    }

    #modalControlVotaciones {
        top: 68px;
        right: 8px;
        width: calc(100vw - 16px);
    }
    
    #votacionOverlay {
        top: 8px;
        min-width: 0;
        width: calc(100vw - 16px);
        padding: 8px 10px;
    }

    .votacion-overlay-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .votacion-overlay-botones {
        width: 100%;
        flex-wrap: wrap;
    }

    .votacion-btn-votar {
        flex: 1 1 30%;
        min-width: 90px;
    }
    
    .votaciones-resultados-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
