/* =====================================================
   TRABAJADORES - Pagina de gestion de trabajadores
   ===================================================== */

/* --- Page Header --- */
.page-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title-section h1 {
    font-size: 28px;
    font-weight: 700;
    color: #4459D7;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: #6b6b6b;
}

/* --- Workers Content --- */
.workers-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 24px;
}

/* --- Workers Grid --- */
.workers-grid {
    margin-top: 24px;
    border-radius: 8px;
    overflow: hidden;
}

.workers-grid .e-grid {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.workers-grid .e-gridheader {
    background: #f5f7fa;
}

.workers-grid .e-headercell {
    font-weight: 600;
    color: #4a5568;
    font-size: 13px;
}

.workers-grid .e-rowcell {
    font-size: 14px;
    color: #2d3748;
    padding: 12px 16px;
}

.workers-grid .e-row:hover {
    background: #f8fafc;
}

/* --- Worker Avatar --- */
.worker-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4459D7 0%, #6366f1 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

/* --- Worker Info Cell --- */
.worker-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.worker-name {
    font-weight: 600;
    color: #2d3748;
}

.worker-email {
    font-size: 12px;
    color: #718096;
}

/* --- Status Badge --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-leave {
    background: #fff3cd;
    color: #856404;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-default {
    background: #e2e8f0;
    color: #4a5568;
}

/* --- Action Buttons --- */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-action {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-edit {
    background: #e8f0fe;
    color: #4459D7;
}

.btn-edit:hover {
    background: #4459D7;
    color: white;
}

.btn-delete {
    background: #fde8e8;
    color: #dc3545;
}

.btn-delete:hover {
    background: #dc3545;
    color: white;
}

/* --- Text Muted --- */
.text-muted {
    color: #a0aec0;
    font-style: italic;
}

/* --- Worker Modal --- */
.worker-modal .e-dlg-content {
    max-height: 70vh;
    overflow-y: auto;
}

.form-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #4459D7;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
}

.form-group .required {
    color: #dc3545;
}

.form-help {
    font-size: 12px;
    color: #718096;
    margin-top: 4px;
}

/* --- Role Badge --- */
.role-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.role-badge-superadmin {
    background: linear-gradient(135deg, #4459D7 0%, #6366f1 100%);
    color: white;
}

.role-badge-admin {
    background: #e8f0fe;
    color: #4459D7;
}

/* --- Fade In Animation --- */
/* NOTE: Using the .fade-in from variables.css which includes 'forwards' */
/* to maintain the final animation state (opacity: 1) */

/* --- Custom Fields Section --- */
.custom-fields-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 20px;
    margin-top: 12px;
    border: 1px solid #e2e8f0;
}

.custom-fields-section .form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #4459D7;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-fields-section .form-section-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(135deg, #4459D7 0%, #6366f1 100%);
    border-radius: 2px;
}

.custom-fields-section .form-row {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
}

.custom-fields-section .form-row:last-child {
    margin-bottom: 0;
}

.custom-fields-section .form-group label {
    color: #374151;
}

.custom-fields-section .form-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    display: block;
}

.custom-fields-section .form-label .required {
    color: #dc3545;
    margin-left: 2px;
}

/* --- Empty Custom Fields --- */
.empty-custom-fields,
.empty-custom-fields-tab {
    text-align: center;
    padding: 40px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}

.empty-custom-fields-tab .empty-icon {
    font-size: 56px;
    margin-bottom: 20px;
    opacity: 0.6;
    filter: grayscale(40%);
}

.empty-custom-fields-tab h4 {
    font-size: 17px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

.empty-custom-fields-tab p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.empty-custom-fields-tab small {
    font-size: 12px;
    color: #9ca3af;
    display: block;
    margin-top: 8px;
}

.empty-custom-fields p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 4px;
}

.empty-custom-fields small {
    font-size: 12px;
    color: #9ca3af;
}

/* --- Loading Custom Fields --- */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px;
    color: #6b7280;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.loading-container .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #4459D7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-container span {
    font-size: 14px;
    font-weight: 500;
}

/* --- Checkbox Container --- */
.checkbox-container {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* --- Worker Modal with Tabs --- */
.worker-modal-tabs .e-dlg-content {
    padding: 20px;
    max-height: calc(80vh - 120px);
    overflow: visible;
    background: #f8fafc;
}

.worker-modal-tabs .e-dlg-header-content {
    background: white;
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.worker-modal-tabs .e-dlg-header {
    color: #4459D7 !important;
    font-weight: 600;
    font-size: 18px;
}

.worker-modal-tabs .e-dlg-closeicon-btn {
    color: #64748b !important;
}

.worker-modal-tabs .e-dlg-closeicon-btn:hover {
    color: #4459D7 !important;
}

/* --- Native Tabs Container --- */
.native-tabs {
    background: white;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Tab Navigation */
.tabs-nav {
    background: #fafbfc;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

/* Flechas de navegación */
.tabs-arrow {
    flex-shrink: 0;
    width: 32px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.tabs-arrow:hover {
    background: #4459D7;
    border-color: #4459D7;
    color: white;
}

.tabs-arrow svg {
    transition: transform 0.15s ease;
}

.tabs-arrow:hover svg {
    transform: scale(1.1);
}

.tabs-nav-scroll {
    display: flex;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    gap: 4px;
}

.tabs-nav-scroll::-webkit-scrollbar {
    display: none;
}

/* Tab Button */
.tab-btn {
    flex-shrink: 0;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.tab-btn:hover {
    color: #4459D7;
    background: rgba(68, 89, 215, 0.04);
}

.tab-btn.active {
    color: #4459D7;
    font-weight: 600;
}

/* Línea inferior animada */
.tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #4459D7;
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.tab-btn.active::after {
    transform: scaleX(1);
}

/* Tab Content */
.tabs-content {
    background: white;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-content-wrapper {
    padding: 20px;
    max-height: calc(60vh - 80px);
    overflow-y: auto;
    background: white;
}

.tab-content-wrapper .form-section {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
    border: none;
    box-shadow: none;
}

/* Form section title removed - each tab has its own title in the header */

.tab-content-wrapper .form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 16px;
}

.tab-content-wrapper .form-row:last-child {
    margin-bottom: 0;
}

.tab-content-wrapper .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tab-content-wrapper .form-group.full-width {
    grid-column: span 2;
}

.tab-content-wrapper .form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.tab-content-wrapper .form-group .required {
    color: #dc3545;
    margin-left: 2px;
}

.tab-content-wrapper .form-help {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.4;
}

/* --- Checkbox Wrapper --- */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* --- Info Boxes --- */
.social-security-info,
.hierarchy-info,
.status-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-radius: 10px;
    padding: 16px;
    margin-top: 20px;
}

.social-security-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
}

.social-security-info p {
    color: #1e40af;
}

.hierarchy-info {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #bbf7d0;
}

.hierarchy-info p {
    color: #166534;
}

.status-info {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 1px solid #fde047;
}

.status-info p {
    color: #854d0e;
}

.social-security-info .info-icon,
.hierarchy-info .info-icon,
.status-info .info-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.social-security-info p,
.hierarchy-info p,
.status-info p {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

/* --- Modal Footer with Tabs --- */
.worker-modal-tabs .modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .workers-content {
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }

    .worker-modal .e-dialog,
    .worker-modal-tabs .e-dialog {
        width: 95% !important;
        max-width: 95% !important;
    }

    .tab-btn {
        padding: 10px 14px;
        font-size: 12px;
    }

    .tab-content-wrapper {
        padding: 16px;
    }

    .tab-content-wrapper .form-row {
        grid-template-columns: 1fr;
    }

    .tab-content-wrapper .form-group.full-width {
        grid-column: span 1;
    }

    .worker-modal-tabs .modal-footer {
        justify-content: center;
    }
}
