/* ===================================
   INSTRUCTORS.CSS - Estilos de Instructores
   =================================== */

/* -------------------------
   Tabla de Instructores Moderna
   ------------------------- */

.table-responsive {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.data-table thead th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody td {
    padding: 16px 12px;
    vertical-align: middle;
    border: none;
}

.instructor-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.4rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.instructor-name {
    font-weight: 600;
    color: #1a202c;
    line-height: 1.3;
}

.instructor-name strong {
    font-size: 0.95rem;
    color: #2d3748;
}

.instructor-name small {
    font-weight: 500;
    font-size: 0.8rem;
    color: #718096;
    display: block;
    margin-top: 4px;
    background: #edf2f7;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.email-link {
    color: #4299e1;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    padding: 4px 8px;
    border-radius: 6px;
}

.email-link:hover {
    color: #3182ce;
    background: #ebf8ff;
    text-decoration: none;
}

.specialties-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 200px;
    min-height: 32px;
    align-items: flex-start;
}

.badge-specialty {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%) !important;
    color: white !important;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex !important;
    align-items: center;
    box-shadow: 0 2px 4px rgba(72, 187, 120, 0.2);
    transition: transform 0.2s;
    margin: 2px;
}

.badge-specialty:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(72, 187, 120, 0.3);
}

.experience-badge {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(237, 137, 54, 0.2);
}

.courses-count {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    box-shadow: 0 2px 4px rgba(66, 153, 225, 0.2);
}

.badge-status {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
}

.badge-status.badge-activo {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(72, 187, 120, 0.2);
}

.badge-status.badge-inactivo {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(245, 101, 101, 0.2);
}

.badge-status.badge-vacaciones {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(237, 137, 54, 0.2);
}

.badge-status.badge-licencia {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.btn-group {
    display: flex;
    gap: 6px;
}

.btn-group .btn {
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-group .btn-outline {
    background: #f7fafc;
    color: #4299e1;
    border: 1px solid #bee3f8;
}

.btn-group .btn-outline:hover {
    background: #4299e1;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(66, 153, 225, 0.3);
}

.btn-group .btn-danger {
    background: #f7fafc;
    color: #f56565;
    border: 1px solid #feb2b2;
}

.btn-group .btn-danger:hover {
    background: #f56565;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 101, 101, 0.3);
}

.specialties-list .text-muted {
    font-style: italic;
    font-size: 0.85rem;
    color: #a0aec0;
    background: #f7fafc;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px dashed #cbd5e0;
}

/* Responsive mejoras */
@media (max-width: 1200px) {
    .specialties-list {
        max-width: 150px;
    }
    
    .badge-specialty {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
}

@media (max-width: 768px) {
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table thead th,
    .data-table tbody td {
        padding: 12px 8px;
    }
    
    .instructor-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .btn-group .btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

.badge-specialty {
    background: var(--gradient-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    display: inline-block;
}

.experience-badge {
    background: var(--success-light);
    color: var(--success-dark);
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.courses-count {
    background: var(--info-light);
    color: var(--info-dark);
    padding: 4px 8px;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-block;
    min-width: 24px;
    text-align: center;
}

.badge-status.badge-activo {
    background: var(--success-light);
    color: var(--success-dark);
}

.badge-status.badge-inactivo {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.badge-status.badge-vacaciones {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.badge-status.badge-licencia {
    background: var(--info-light);
    color: var(--info-dark);
}

/* -------------------------
   Controles de Filtrado y Búsqueda
   ------------------------- */

.instructors-controls {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.instructors-controls .row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -15px;
    margin-right: -15px;
    gap: 16px; /* Agregar separación entre controles */
    align-items: center;
}

.instructors-controls .col-md-4 {
    position: relative;
    padding-left: 15px;
    padding-right: 15px;
    margin-bottom: 16px; /* Separación vertical para móviles */
}

.instructors-search {
    position: relative;
}

.instructors-search input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #f8fafc;
}

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

.instructors-search::before {
    content: "🔍";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    z-index: 2;
}

.filter-select {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 100%;
}

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

/* -------------------------
   Header de la página
   ------------------------- */

.instructors-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.instructors-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-add-instructor {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-instructor:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

/* -------------------------
   Estados de la tabla
   ------------------------- */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state h3 {
    color: #4a5568;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: #718096;
    font-size: 1rem;
    margin-bottom: 24px;
}

/* -------------------------
   Loading State
   ------------------------- */

.table-loading {
    text-align: center;
    padding: 40px;
    color: #718096;
}

.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive para controles */
@media (max-width: 768px) {
    .instructors-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .instructors-controls {
        padding: 16px;
    }
    
    .instructors-controls .row {
        flex-direction: column;
        gap: 12px;
        margin-left: 0;
        margin-right: 0;
    }
    
    .instructors-controls .row > div {
        margin-bottom: 12px;
        width: 100%;
    }
    
    .instructors-controls .col-md-4 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        padding-left: 0;
        padding-right: 0;
    }
    
    .btn-add-instructor {
        width: 100%;
        justify-content: center;
    }
    
    /* Tabla responsive */
    .data-table {
        font-size: 0.8rem;
        min-width: 800px; /* Forzar scroll horizontal en móviles */
    }
}

/* Mejorar espaciado de los controles en desktop */
@media (min-width: 769px) {
    .instructors-controls .row {
        justify-content: flex-start;
    }
    
    .instructors-controls .col-md-4 {
        flex: 0 0 30%;
        max-width: 30%;
    }
}

/* Sistema de grid básico para compatibilidad */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -15px;
    margin-right: -15px;
}

.col-md-4 {
    position: relative;
    padding-left: 15px;
    padding-right: 15px;
    width: 100%;
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

@media (max-width: 768px) {
    .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

.instructor-modal {
    width: 90vw;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-section {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.modal-section h4 {
    color: var(--primary-color);
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-section h4 i {
    font-size: 1rem;
}

/* -------------------------
   Especialidades Dinámicas
   ------------------------- */

.specialty-item {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.specialty-item:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.1);
}

.specialty-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
}

.specialty-header h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.remove-specialty {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.remove-specialty:hover {
    background: var(--danger-dark);
}

.specialty-language {
    font-weight: 500;
}

.specialty-language:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* -------------------------
   Checkbox Groups
   ------------------------- */

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    user-select: none;
    transition: color 0.2s;
}

.checkbox-item:hover {
    color: var(--primary-color);
}

.checkbox-item input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.checkbox-item input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 11px;
    font-weight: bold;
}

.checkbox-item input[type="checkbox"]:hover {
    border-color: var(--primary-light);
}

.checkbox-item .checkmark {
    display: none; /* Usamos ::after en su lugar */
}

/* -------------------------
   Botones de Acción Especiales
   ------------------------- */

#add-specialty {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
}

#add-specialty:hover {
    background: var(--success-dark);
    transform: translateY(-1px);
}

/* -------------------------
   Responsive Design
   ------------------------- */

@media (max-width: 768px) {
    .instructor-modal {
        width: 95vw;
        margin: 10px;
    }
    
    .modal-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .specialty-item {
        padding: 15px;
    }
    
    .specialties-list {
        max-width: 150px;
    }
    
    .checkbox-group {
        gap: 8px;
    }
    
    .checkbox-item {
        font-size: 0.85rem;
    }
    
    .specialty-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .checkbox-group {
        flex-direction: column;
        gap: 6px;
    }
    
    .instructor-avatar {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }
    
    .specialties-list {
        max-width: 120px;
    }
    
    .badge-specialty {
        font-size: 0.7rem;
        padding: 1px 6px;
    }
}

/* -------------------------
   Estados de Carga
   ------------------------- */

.specialty-item.loading {
    opacity: 0.7;
    pointer-events: none;
}

.specialty-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-light);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* -------------------------
   Validación de Campos
   ------------------------- */

.specialty-item .form-input.error,
.specialty-item .form-select.error {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.specialty-error {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 4px;
    display: block;
}

/* -------------------------
   Animaciones
   ------------------------- */

.specialty-item {
    animation: slideIn 0.3s ease-out;
}

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

.specialty-item.removing {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(-100%);
        height: 0;
        margin: 0;
        padding: 0;
    }
}