/**
 * ════════════════════════════════════════════════════════════
 * CSS MEJORADO PARA GESTIÓN DE POPUP MENSAJES
 * Versión: 2.1 - Diseño Profesional y Ordenado
 * ════════════════════════════════════════════════════════════
 */

/* ════════════════════════════════════════════════════════════
   CONTENEDOR PRINCIPAL
   ════════════════════════════════════════════════════════════ */
#gestionPopupContainer {
    background: #f8f9fa;
    padding: 20px;
    min-height: calc(100vh - 100px);
}

.gestion-popup {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* ════════════════════════════════════════════════════════════
   HEADER MEJORADO
   ════════════════════════════════════════════════════════════ */
.gestion-popup .header-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 25px 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.gestion-popup .header-section h2 {
    color: white;
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gestion-popup .header-section h2 i {
    font-size: 32px;
}

/* ════════════════════════════════════════════════════════════
   BOTONES MEJORADOS
   ════════════════════════════════════════════════════════════ */
#btnNuevoMensaje {
    background: white;
    color: #667eea;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

#btnNuevoMensaje:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #f8f9fa;
}

#btnNuevoMensaje i {
    font-size: 18px;
}

/* ════════════════════════════════════════════════════════════
   TARJETAS DE MENSAJES MEJORADAS
   ════════════════════════════════════════════════════════════ */
.gestion-popup .card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    background: white;
}

.gestion-popup .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.gestion-popup .card.border-success {
    border-left: 4px solid #28a745 !important;
}

.gestion-popup .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    padding: 15px 20px;
    font-weight: 600;
}

.gestion-popup .card-body {
    padding: 20px;
}

/* ════════════════════════════════════════════════════════════
   PREVIEW DEL MENSAJE
   ════════════════════════════════════════════════════════════ */
.mensaje-preview {
    max-height: 450px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    font-size: 14px;
    line-height: 1.6;
}

.mensaje-preview::-webkit-scrollbar {
    width: 6px;
}

.mensaje-preview::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.mensaje-preview::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

/* ════════════════════════════════════════════════════════════
   BADGES Y ETIQUETAS
   ════════════════════════════════════════════════════════════ */
.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.badge.bg-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
}

.badge.bg-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
    color: white !important;
}

/* ════════════════════════════════════════════════════════════
   INFORMACIÓN DEL MENSAJE
   ════════════════════════════════════════════════════════════ */
.gestion-popup .card-body p {
    margin-bottom: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gestion-popup .card-body p strong {
    color: #495057;
    min-width: 80px;
}

.gestion-popup .card-body p.text-muted {
    color: #6c757d !important;
    font-size: 12px;
}

.gestion-popup .card-body p i {
    color: #667eea;
    width: 18px;
}

/* ════════════════════════════════════════════════════════════
   BOTONES DE ACCIÓN EN TARJETAS - LAYOUT VERTICAL MEJORADO
   ════════════════════════════════════════════════════════════ */
.btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.btn-group-vertical .btn-group {
    display: flex;
    gap: 8px;
    width: 100%;
}

.btn-group-vertical .btn {
    flex: 1;
    border-radius: 8px !important;
    border: none;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Botón Activar/Desactivar */
.btn-group-vertical .btn-success,
.btn-group-vertical .btn-warning {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-group-vertical .btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #212529;
}

/* Botón Editar */
.btn-group-vertical .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Botón Enviar Ahora */
.btn-group-vertical .btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(23, 162, 184, 0.3);
}

.btn-group-vertical .btn-info:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.4);
}

/* Botón Eliminar */
.btn-group-vertical .btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

/* Hover effects */
.btn-group-vertical .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Iconos en botones */
.btn-group-vertical .btn i {
    font-size: 14px;
}

/* ════════════════════════════════════════════════════════════
   FORMULARIO MEJORADO
   ════════════════════════════════════════════════════════════ */
#formMensaje {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#formMensaje .card {
    border: 2px solid #667eea;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
}

#formMensaje .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
}

#formMensaje .card-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: block;
}

.form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

/* ════════════════════════════════════════════════════════════
   CHECKBOXES Y RADIOS MEJORADOS
   ════════════════════════════════════════════════════════════ */
.form-check {
    padding: 8px 0;
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin-top: 0;
    border: 2px solid #dee2e6;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.form-check-label {
    margin-left: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
}

.form-check-label strong {
    color: #212529;
}

.form-check-label small {
    display: block;
    margin-top: 4px;
    color: #6c757d;
    font-size: 12px;
}

/* ════════════════════════════════════════════════════════════
   SELECTOR DE CURSOS MEJORADO
   ════════════════════════════════════════════════════════════ */
#selectorCursos {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid #e9ecef;
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
}

#selectorCursos small {
    display: block;
    margin-bottom: 10px;
    color: #6c757d;
    font-weight: 600;
}

#selectorCursos > div {
    margin-bottom: 15px;
}

#selectorCursos > div > strong {
    display: block;
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 14px;
}

#selectorCursos::-webkit-scrollbar {
    width: 8px;
}

#selectorCursos::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

#selectorCursos::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

/* ════════════════════════════════════════════════════════════
   ALERTAS MEJORADAS
   ════════════════════════════════════════════════════════════ */
.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    border: 2px solid #17a2b8;
    border-radius: 8px;
    padding: 15px;
    color: #0c5460;
}

.alert-info strong {
    color: #0c5460;
}

.alert-info i {
    font-size: 18px;
    margin-right: 8px;
}

/* ════════════════════════════════════════════════════════════
   BOTONES DE ACCIÓN DEL FORMULARIO
   ════════════════════════════════════════════════════════════ */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.form-actions .btn {
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-actions .btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    flex: 1;
}

.form-actions .btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.form-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.form-actions .btn i {
    font-size: 18px;
}

/* ════════════════════════════════════════════════════════════
   GRID DE TARJETAS RESPONSIVE
   ════════════════════════════════════════════════════════════ */
.row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* ════════════════════════════════════════════════════════════
   MENSAJE VACÍO
   ════════════════════════════════════════════════════════════ */
.text-center.py-5 {
    background: white;
    border-radius: 12px;
    padding: 60px 30px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.text-center.py-5 i {
    color: #dee2e6;
}

.text-center.py-5 h3 {
    color: #495057;
    margin-top: 20px;
    margin-bottom: 10px;
}

.text-center.py-5 p {
    color: #6c757d;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .gestion-popup .header-section {
        flex-direction: column;
        text-align: center;
    }
    
    .gestion-popup .header-section h2 {
        font-size: 24px;
    }
    
    #btnNuevoMensaje {
        width: 100%;
        justify-content: center;
    }
    
    .row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .btn-group-vertical .btn-group {
        flex-direction: column;
    }
}

/* ════════════════════════════════════════════════════════════
   ANIMACIONES
   ════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.gestion-popup .card {
    animation: fadeIn 0.3s ease;
}

/* ════════════════════════════════════════════════════════════
   FIN DEL CSS
   ════════════════════════════════════════════════════════════ */
