/**
 * 🎨 PERSONALIZACIÓN SELECT2 PARA BUSCADOR DE CURSOS
 * Estilos premium para búsqueda avanzada de cursos en inscripciones
 */

/* Contenedor principal */
.select2-container {
    width: 100% !important;
}

/* Input de búsqueda */
.select2-container--default .select2-selection--single {
    height: 42px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.3s ease;
    background: white;
}

.select2-container--default .select2-selection--single:hover {
    border-color: #667eea;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Placeholder */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #999;
    font-weight: 400;
}

/* Texto seleccionado */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 24px;
    padding-left: 0;
    color: #333;
    font-weight: 500;
}

/* Flecha dropdown */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: 8px;
}

/* Dropdown */
.select2-dropdown {
    border: 2px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 4px;
    overflow: hidden;
}

/* Input de búsqueda dentro del dropdown */
.select2-search--dropdown .select2-search__field {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    margin: 8px;
    width: calc(100% - 16px) !important;
    transition: all 0.3s ease;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Placeholder del buscador */
.select2-search--dropdown .select2-search__field::placeholder {
    color: #999;
    font-weight: 400;
}

/* Opciones */
.select2-results__option {
    padding: 12px 16px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.select2-results__option--highlighted[aria-selected] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

/* Opciones de cursos con información adicional */
.curso-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.curso-option-title {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.curso-option-info {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #666;
}

.curso-option-badge {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.curso-option-badge.codigo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.curso-option-badge.sede {
    background: #e7f3ff;
    color: #004085;
}

.curso-option-badge.año {
    background: #d1fae5;
    color: #065f46;
}

.curso-option-badge.mes {
    background: #fff7ed;
    color: #c2410c;
}

/* Resaltado de búsqueda */
.select2-results__option--highlighted[aria-selected] .curso-option-title {
    color: white;
}

.select2-results__option--highlighted[aria-selected] .curso-option-info {
    color: rgba(255, 255, 255, 0.9);
}

.select2-results__option--highlighted[aria-selected] .curso-option-badge {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Sin resultados */
.select2-results__option.select2-results__message {
    color: #999;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Loading */
.select2-results__option--loading {
    color: #667eea;
    padding: 20px;
    text-align: center;
}

/* Scrollbar personalizado */
.select2-results__options::-webkit-scrollbar {
    width: 8px;
}

.select2-results__options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.select2-results__options::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.select2-results__options::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f91 100%);
}

/* Animación de apertura */
.select2-dropdown {
    animation: slideDown 0.3s ease;
}

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

/* ========================================
   🔍 BUSCADOR DE CHECKBOXES
   ======================================== */

/* Input de búsqueda para checkboxes */
#buscadorCursosCheckbox {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: all 0.3s ease;
}

#buscadorCursosCheckbox:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* Items de checkbox con animación */
.curso-checkbox-item {
    transition: all 0.2s ease;
}

.curso-checkbox-item[style*="display: none"] {
    opacity: 0;
    transform: scale(0.95);
}

/* Mensaje de sin resultados */
.no-results-message {
    animation: fadeIn 0.3s ease;
}

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

/* Highlight en hover */
.curso-checkbox-item:hover {
    transform: translateX(5px);
}

/* Responsive */
@media (max-width: 768px) {
    #buscadorCursosCheckbox {
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    .select2-results__option {
        padding: 10px 12px;
    }
    
    .curso-option-title {
        font-size: 14px;
    }
    
    .curso-option-info {
        font-size: 11px;
    }
}

/* Estado deshabilitado */
.select2-container--default.select2-container--disabled .select2-selection--single {
    background-color: #f5f5f5;
    cursor: not-allowed;
    border-color: #e0e0e0;
}

/* Clear button */
.select2-selection__clear {
    color: #999;
    font-size: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.select2-selection__clear:hover {
    color: #ef4444;
}
